java.nio.BufferUnderflowException
BufferUnderflowException is described in the javadoc comments as:
Unchecked exception thrown when a relative get operation reaches the source buffer's limit.
version: 1.14, 01/05/02 since: 1.4
Where is this exception thrown?
Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.
- The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.Buffer.nextGetIndex() - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.Buffer.nextGetIndex(int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.ByteBuffer.get(byte[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.CharBuffer.get(char[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectByteBuffer.get(byte[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectCharBufferS.get(char[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectCharBufferU.get(char[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectDoubleBufferS.get(double[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectDoubleBufferU.get(double[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectFloatBufferS.get(float[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectFloatBufferU.get(float[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectIntBufferS.get(int[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectIntBufferU.get(int[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectLongBufferS.get(long[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectLongBufferU.get(long[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectShortBufferS.get(short[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DirectShortBufferU.get(short[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.DoubleBuffer.get(double[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.FloatBuffer.get(float[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapByteBuffer.get(byte[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapCharBuffer.get(char[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapDoubleBuffer.get(double[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapFloatBuffer.get(float[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapIntBuffer.get(int[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapLongBuffer.get(long[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.HeapShortBuffer.get(short[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.IntBuffer.get(int[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.LongBuffer.get(long[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.ShortBuffer.get(short[], int, int) - The message 'java.nio.BufferUnderflowException: ' is thrown within the method:
java.nio.charset.CoderResult.throwException()
How is this exception thrown?
The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.
Any source code quoted in this section is subject to the Java Research License unless stated otherwise.
java.nio.Buffer.nextGetIndex()
/** * Checks the current position against the limit, throwing a {@link * BufferUnderflowException} if it is not smaller than the limit, and then * increments the position. * @return The current position value, before it is incremented */ final int nextGetIndex() { if (position >= limit) throw new BufferUnderflowException(); return position++; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.Buffer.nextGetIndex(int)
final int nextGetIndex(int nb) { if (limit - position < nb) throw new BufferUnderflowException(); int p = position; position += nb; return p; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.ByteBuffer.get(byte[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers bytes from this buffer into the given * destination array. If there are fewer bytes remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * bytes are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> bytes from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient bytes in * this buffer and it is potentially much more efficient. * @param dst * The array into which bytes are to be written * @param offset * The offset within the array of the first byte to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of bytes to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> bytes * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public ByteBuffer get(byte[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.CharBuffer.get(char[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers characters from this buffer into the given * destination array. If there are fewer characters remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * characters are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> characters from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient characters in * this buffer and it is potentially much more efficient. * @param dst * The array into which characters are to be written * @param offset * The offset within the array of the first character to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of characters to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> characters * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public CharBuffer get(char[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectByteBuffer.get(byte[], int, int)
public ByteBuffer get(byte[] dst, int offset, int length) { if ((length << 0) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToByteArray(ix(pos), dst, offset << 0, length << 0); else Bits.copyToByteArray(ix(pos), dst, offset << 0, length << 0); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectCharBufferS.get(char[], int, int)
public CharBuffer get(char[] dst, int offset, int length) { if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToCharArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectCharBufferU.get(char[], int, int)
public CharBuffer get(char[] dst, int offset, int length) { if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToCharArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectDoubleBufferS.get(double[], int, int)
public DoubleBuffer get(double[] dst, int offset, int length) { if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectDoubleBufferU.get(double[], int, int)
public DoubleBuffer get(double[] dst, int offset, int length) { if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectFloatBufferS.get(float[], int, int)
public FloatBuffer get(float[] dst, int offset, int length) { if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectFloatBufferU.get(float[], int, int)
public FloatBuffer get(float[] dst, int offset, int length) { if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectIntBufferS.get(int[], int, int)
public IntBuffer get(int[] dst, int offset, int length) { if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectIntBufferU.get(int[], int, int)
public IntBuffer get(int[] dst, int offset, int length) { if ((length << 2) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToIntArray(ix(pos), dst, offset << 2, length << 2); else Bits.copyToByteArray(ix(pos), dst, offset << 2, length << 2); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectLongBufferS.get(long[], int, int)
public LongBuffer get(long[] dst, int offset, int length) { if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectLongBufferU.get(long[], int, int)
public LongBuffer get(long[] dst, int offset, int length) { if ((length << 3) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToLongArray(ix(pos), dst, offset << 3, length << 3); else Bits.copyToByteArray(ix(pos), dst, offset << 3, length << 3); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectShortBufferS.get(short[], int, int)
public ShortBuffer get(short[] dst, int offset, int length) { if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToShortArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DirectShortBufferU.get(short[], int, int)
public ShortBuffer get(short[] dst, int offset, int length) { if ((length << 1) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) { checkBounds(offset, length, dst.length); int pos = position(); int lim = limit(); assert (pos <= lim); int rem = (pos <= lim ? lim - pos : 0); if (length > rem) throw new BufferUnderflowException(); if (order() != ByteOrder.nativeOrder()) Bits.copyToShortArray(ix(pos), dst, offset << 1, length << 1); else Bits.copyToByteArray(ix(pos), dst, offset << 1, length << 1); position(pos + length); } else { super.get(dst, offset, length); } return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.DoubleBuffer.get(double[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers doubles from this buffer into the given * destination array. If there are fewer doubles remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * doubles are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> doubles from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient doubles in * this buffer and it is potentially much more efficient. * @param dst * The array into which doubles are to be written * @param offset * The offset within the array of the first double to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of doubles to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> doubles * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public DoubleBuffer get(double[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.FloatBuffer.get(float[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers floats from this buffer into the given * destination array. If there are fewer floats remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * floats are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> floats from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient floats in * this buffer and it is potentially much more efficient. * @param dst * The array into which floats are to be written * @param offset * The offset within the array of the first float to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of floats to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> floats * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public FloatBuffer get(float[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapByteBuffer.get(byte[], int, int)
public ByteBuffer get(byte[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapCharBuffer.get(char[], int, int)
public CharBuffer get(char[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapDoubleBuffer.get(double[], int, int)
public DoubleBuffer get(double[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapFloatBuffer.get(float[], int, int)
public FloatBuffer get(float[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapIntBuffer.get(int[], int, int)
public IntBuffer get(int[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapLongBuffer.get(long[], int, int)
public LongBuffer get(long[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.HeapShortBuffer.get(short[], int, int)
public ShortBuffer get(short[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); System.arraycopy(hb, ix(position()), dst, offset, length); position(position() + length); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.IntBuffer.get(int[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers ints from this buffer into the given * destination array. If there are fewer ints remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * ints are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> ints from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient ints in * this buffer and it is potentially much more efficient. * @param dst * The array into which ints are to be written * @param offset * The offset within the array of the first int to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of ints to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> ints * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public IntBuffer get(int[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.LongBuffer.get(long[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers longs from this buffer into the given * destination array. If there are fewer longs remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * longs are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> longs from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient longs in * this buffer and it is potentially much more efficient. * @param dst * The array into which longs are to be written * @param offset * The offset within the array of the first long to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of longs to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> longs * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public LongBuffer get(long[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.ShortBuffer.get(short[], int, int)
/** * Relative bulk <i>get</i> method. * This method transfers shorts from this buffer into the given * destination array. If there are fewer shorts remaining in the * buffer than are required to satisfy the request, that is, if * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no * shorts are transferred and a {@link BufferUnderflowException} is * thrown. * Otherwise, this method copies <tt>length</tt> shorts from this * buffer into the given array, starting at the current position of this * buffer and at the given offset in the array. The position of this * buffer is then incremented by <tt>length</tt>. * In other words, an invocation of this method of the form * <tt>src.get(dst, off, len)</tt> has exactly the same effect as * the loop * * for (int i = off; i < off + len; i++) * dst[i] = src.get(); * except that it first checks that there are sufficient shorts in * this buffer and it is potentially much more efficient. * @param dst * The array into which shorts are to be written * @param offset * The offset within the array of the first short to be * written; must be non-negative and no larger than * <tt>dst.length</tt> * @param length * The maximum number of shorts to be written to the given * array; must be non-negative and no larger than * <tt>dst.length - offset</tt> * @return This buffer * @throws BufferUnderflowException * If there are fewer than <tt>length</tt> shorts * remaining in this buffer * @throws IndexOutOfBoundsException * If the preconditions on the <tt>offset</tt> and <tt>length</tt> * parameters do not hold */ public ShortBuffer get(short[] dst, int offset, int length) { checkBounds(offset, length, dst.length); if (length > remaining()) throw new BufferUnderflowException(); int end = offset + length; for (int i = offset; i < end; i++) dst[i] = get(); return this; }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
java.nio.charset.CoderResult.throwException()
/** * Throws an exception appropriate to the result described by this object. * * @throws BufferUnderflowException * If this object is {@link #UNDERFLOW} * @throws BufferOverflowException * If this object is {@link #OVERFLOW} * @throws MalformedInputException * If this object represents a malformed-input error; the * exception's length value will be that of this object * @throws UnmappableCharacterException * If this object represents an unmappable-character error; the * exceptions length value will be that of this object */ public void throwException() throws CharacterCodingException { switch(type) { case CR_UNDERFLOW: throw new BufferUnderflowException(); case CR_OVERFLOW: throw new BufferOverflowException(); case CR_MALFORMED: throw new MalformedInputException(length); case CR_UNMAPPABLE: throw new UnmappableCharacterException(length); default: assert false; } }
Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html
Comments
Post a Comment