java.nio.ByteBuffer
A byte buffer.
This class defines six categories of operations upon byte buffers:
1. Absolute and relative get and put methods that read and write single bytes.
2. Absolute and relative bulk get methods that transfer contiguous sequences of bytes from this buffer into an array.
3. Absolute and Relative bulk put methods that transfer contiguous sequences of bytes from a byte array or some other bytebuffer into this buffer.
4. Absolute and relative get and put methods that read and write values of other primitive types, translating them to and from sequences of bytes in particular byte order.
5. Methods for creating view buffers, which allow a byte buffer to be viewed as a buffer containing values of some other primitive type.
6. A method for compacting a byte buffer.
Some methods of ByteBuffer class
get(): It reads the byte at this buffer's current position and then increments the position.
get(byte[]): It transfers bytes from this buffer into the given destination array.
get(int): It reads the byte at the given index.
get(int, byte[]): It transfers bytes from this buffer into the given destination array.
get(byte[], int, int): . It transfers bytes from this buffer into the given destination array.
get(int, byte[], int , int): It transfers length bytes from this buffer into the given array, starting at the given index in this buffer and at the given offset in the array.
getChar(): It reads the next two bytes at this buffer's current position, composing them into a char value according to the current byte order, and then increments the position by two.
getDouble(): It reads the next eight bytes at this buffer's current position, composing them into a double value according to the current byte order, and then increments the position by eight.
getFloat(): It reads the next four bytes at this buffer's current position, composing them into a float value according to the current byte order, and then increments the position by four.
getInt(): It reads the next four bytes at this buffer's current position, composing them into an int value according to the current byte order, and then increments the position by four.
getLong(): It reads the next eight bytes at this buffer's current position, composing them into a long value according to the current byte order, and then increments the position by eight.
getShort(): It reads the next two bytes at this buffer's current position, composing them into a short value according to the current byte order, and then increments the position by two.
hasArray(): It tells whether or not this buffer is backed by an accessible byte array.
hashCode(): It returns the current hash code of this buffer.
hasRemaining(): It tells whether there are any elements between the current position and the limit.
isDirect(): It tells whether or not this byte buffer is direct.
isReadOnly(): It tells whether or not this buffer is read-only.
limit(): It returns this buffer's limit or This method sets this buffer's limit.
No comments:
Post a Comment