本文整理汇总了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);
}
}