java.lang.Objectjava.nio.Buffer
java.nio.ByteBuffer
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
ReadOnly, MappedByteBufferImpl, MappedByteBufferAdapter, ReadWriteHeapByteBuffer, DirectByteBuffer, ReadWrite, BaseByteBuffer, ReadOnlyDirectByteBuffer, DirectByteBufferImpl, ReadOnlyHeapByteBuffer, ReadWriteDirectByteBuffer, HeapByteBuffer, ByteBufferImpl, MappedByteBuffer
A byte buffer can be created in either one of the following ways:
Field Summary | ||
---|---|---|
Endianness | order | The byte order of this buffer, default is {@code BIG_ENDIAN}. |
Fields inherited from java.nio.Buffer: |
---|
address |
Constructor: |
---|
|
Method from java.nio.ByteBuffer Summary: |
---|
allocate, allocateDirect, array, arrayOffset, asCharBuffer, asDoubleBuffer, asFloatBuffer, asIntBuffer, asLongBuffer, asReadOnlyBuffer, asShortBuffer, compact, compareTo, duplicate, equals, get, get, get, get, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, hasArray, hashCode, isDirect, order, order, orderImpl, protectedArray, protectedArrayOffset, protectedHasArray, put, put, put, put, put, putChar, putChar, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, slice, toString, wrap, wrap |
Methods from java.nio.Buffer: |
---|
array, arrayOffset, capacity, checkBounds, checkIndex, checkIndex, clear, discardMark, flip, hasArray, hasRemaining, isDirect, isReadOnly, limit, limit, mark, markValue, nextGetIndex, nextGetIndex, nextPutIndex, nextPutIndex, position, position, remaining, reset, rewind |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from java.nio.ByteBuffer Detail: |
---|
|
|
|
The offset is the index of the array which corresponds to the zero position of the buffer. |
The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by eight, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by four, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by four, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by eight, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
The returned buffer is guaranteed to be a new instance, even if this buffer is read-only itself. The new buffer's position, limit, capacity and mark are the same as this buffer. The new buffer shares its content with this buffer, which means this buffer's change of content will be visible to the new buffer. The two buffer's position, limit and mark are independent. |
The new buffer's position is zero, its limit and capacity is the number of remaining bytes divided by two, and its mark is not set. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer is direct if this byte buffer is direct. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
The remaining bytes will be moved to the head of the buffer, starting from position zero. Then the position is set to {@code remaining()}; the limit is set to capacity; the mark is cleared. |
|
The duplicated buffer's position, limit, capacity and mark are the same as this buffer's. The duplicated buffer's read-only property and byte order are the same as this buffer's too. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
If {@code other} is not a byte buffer then {@code false} is returned. Two byte buffers are equal if and only if their remaining bytes are exactly the same. Position, limit, capacity and mark are not considered. |
|
Calling this method has the same effect as {@code get(dest, 0, dest.length)}. |
|
|
The 2 bytes starting at the current position are composed into a char according to the current byte order and returned. |
The 2 bytes starting from the specified index are composed into a char according to the current byte order and returned. The position is not changed. |
The 8 bytes starting from the current position are composed into a double according to the current byte order and returned. |
The 8 bytes starting at the specified index are composed into a double according to the current byte order and returned. The position is not changed. |
The 4 bytes starting at the current position are composed into a float according to the current byte order and returned. |
The 4 bytes starting at the specified index are composed into a float according to the current byte order and returned. The position is not changed. |
The 4 bytes starting at the current position are composed into a int according to the current byte order and returned. |
The 4 bytes starting at the specified index are composed into a int according to the current byte order and returned. The position is not changed. |
The 8 bytes starting at the current position are composed into a long according to the current byte order and returned. |
The 8 bytes starting at the specified index are composed into a long according to the current byte order and returned. The position is not changed. |
The 2 bytes starting at the current position are composed into a short according to the current byte order and returned. |
The 2 bytes starting at the specified index are composed into a short according to the current byte order and returned. The position is not changed. |
|
|
|
The default byte order of byte buffer is always BIG_ENDIAN |
|
|
|
|
|
|
Calling this method has the same effect as {@code put(src, 0, src.length)}. |
|
|
|
The char is converted to bytes using the current byte order. |
The char is converted to bytes using the current byte order. The position is not changed. |
The double is converted to bytes using the current byte order. |
The double is converted to bytes using the current byte order. The position is not changed. |
The float is converted to bytes using the current byte order. |
The float is converted to bytes using the current byte order. The position is not changed. |
The int is converted to bytes using the current byte order. |
The int is converted to bytes using the current byte order. The position is not changed. |
The long is converted to bytes using the current byte order. |
The long is converted to bytes using the current byte order. The position is not changed. |
The short is converted to bytes using the current byte order. |
The short is converted to bytes using the current byte order. The position is not changed. |
The sliced buffer's capacity will be this buffer's {@code remaining()}, and it's zero position will correspond to this buffer's current position. The new buffer's position will be 0, limit will be its capacity, and its mark is cleared. The new buffer's read-only property and byte order are the same as this buffer's. The new buffer shares its content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent. |
|
Calling this method has the same effect as {@code wrap(array, 0, array.length)}. |
The new buffer's position will be {@code start}, limit will be {@code start + len}, capacity will be the length of the array. |