本文整理匯總了Java中java.nio.BufferOverflowException.initCause方法的典型用法代碼示例。如果您正苦於以下問題:Java BufferOverflowException.initCause方法的具體用法?Java BufferOverflowException.initCause怎麽用?Java BufferOverflowException.initCause使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.nio.BufferOverflowException
的用法示例。
在下文中一共展示了BufferOverflowException.initCause方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: encode
import java.nio.BufferOverflowException; //導入方法依賴的package包/類
private static void encode(CharSequence paramCharSequence, ByteBuffer paramByteBuffer)
{
if (paramByteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
}
if (paramByteBuffer.hasArray()) {
try
{
paramByteBuffer.position(encode(paramCharSequence, paramByteBuffer.array(), paramByteBuffer.arrayOffset() + paramByteBuffer.position(), paramByteBuffer.remaining()) - paramByteBuffer.arrayOffset());
return;
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
BufferOverflowException localBufferOverflowException = new BufferOverflowException();
localBufferOverflowException.initCause(localArrayIndexOutOfBoundsException);
throw localBufferOverflowException;
}
}
encodeDirect(paramCharSequence, paramByteBuffer);
}
示例2: zza
import java.nio.BufferOverflowException; //導入方法依賴的package包/類
private static void zza(CharSequence paramCharSequence, ByteBuffer paramByteBuffer)
{
if (paramByteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
}
if (paramByteBuffer.hasArray()) {
try
{
paramByteBuffer.position(zza(paramCharSequence, paramByteBuffer.array(), paramByteBuffer.arrayOffset() + paramByteBuffer.position(), paramByteBuffer.remaining()) - paramByteBuffer.arrayOffset());
return;
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
BufferOverflowException localBufferOverflowException = new BufferOverflowException();
localBufferOverflowException.initCause(localArrayIndexOutOfBoundsException);
throw localBufferOverflowException;
}
}
zzb(paramCharSequence, paramByteBuffer);
}
示例3: a
import java.nio.BufferOverflowException; //導入方法依賴的package包/類
private static void a(CharSequence paramCharSequence, ByteBuffer paramByteBuffer)
{
if (paramByteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
}
if (paramByteBuffer.hasArray()) {
try
{
paramByteBuffer.position(a(paramCharSequence, paramByteBuffer.array(), paramByteBuffer.arrayOffset() + paramByteBuffer.position(), paramByteBuffer.remaining()) - paramByteBuffer.arrayOffset());
return;
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
BufferOverflowException localBufferOverflowException = new BufferOverflowException();
localBufferOverflowException.initCause(localArrayIndexOutOfBoundsException);
throw localBufferOverflowException;
}
}
b(paramCharSequence, paramByteBuffer);
}
示例4: encode
import java.nio.BufferOverflowException; //導入方法依賴的package包/類
/**
* Encodes {@code sequence} into UTF-8, in {@code byteBuffer}. For a string, this method is
* equivalent to {@code buffer.put(string.getBytes(UTF_8))}, but is more efficient in both time
* and space. Bytes are written starting at the current position. This method requires paired
* surrogates, and therefore does not support chunking.
*
* <p>To ensure sufficient space in the output buffer, either call {@link #encodedLength} to
* compute the exact amount needed, or leave room for {@code 3 * sequence.length()}, which is the
* largest possible number of bytes that any input can be encoded to.
*
* @throws IllegalArgumentException if {@code sequence} contains ill-formed UTF-16 (unpaired
* surrogates)
* @throws BufferOverflowException if {@code sequence} encoded in UTF-8 does not fit in
* {@code byteBuffer}'s remaining space.
* @throws ReadOnlyBufferException if {@code byteBuffer} is a read-only buffer.
*/
private static void encode(CharSequence sequence, ByteBuffer byteBuffer) {
if (byteBuffer.isReadOnly()) {
throw new ReadOnlyBufferException();
} else if (byteBuffer.hasArray()) {
try {
int encoded = encode(sequence,
byteBuffer.array(),
byteBuffer.arrayOffset() + byteBuffer.position(),
byteBuffer.remaining());
byteBuffer.position(encoded - byteBuffer.arrayOffset());
} catch (ArrayIndexOutOfBoundsException e) {
BufferOverflowException boe = new BufferOverflowException();
boe.initCause(e);
throw boe;
}
} else {
encodeDirect(sequence, byteBuffer);
}
}