Package com.mckoi.util
Class ByteBuffer
- java.lang.Object
-
- com.mckoi.util.ByteBuffer
-
public final class ByteBuffer extends java.lang.ObjectA wrapper for an array of byte[]. This provides various functions for altering the state of the buffer.- Author:
- Tobias Downer
-
-
Constructor Summary
Constructors Constructor Description ByteBuffer(byte[] buf)ByteBuffer(byte[] buf, int offset, int length)Constructs the buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufferget(byte[] b, int offset, int length)Gets a byte array from the buffer.bytegetByte()intgetInt()shortgetShort()intlimit()Returns the limit of this buffer.intposition()Returns the current position.voidposition(int position)Sets the position in to the buffer.ByteBufferput(byte[] b)ByteBufferput(byte[] b, int offset, int length)Puts a byte array into the buffer.ByteBufferput(ByteBuffer buffer)Puts a ByteBuffer in to this buffer.ByteBufferputByte(byte v)Puts/Gets a byte into the buffer at the current position.ByteBufferputInt(int v)Puts/Gets an integer into the buffer at the current position.ByteBufferputShort(short v)Puts/Gets a short into the buffer at the current position.
-
-
-
Method Detail
-
position
public void position(int position)
Sets the position in to the buffer.
-
position
public int position()
Returns the current position.
-
limit
public int limit()
Returns the limit of this buffer.
-
put
public ByteBuffer put(byte[] b, int offset, int length)
Puts a byte array into the buffer.
-
put
public ByteBuffer put(byte[] b)
-
put
public ByteBuffer put(ByteBuffer buffer)
Puts a ByteBuffer in to this buffer.
-
get
public ByteBuffer get(byte[] b, int offset, int length)
Gets a byte array from the buffer.
-
putInt
public ByteBuffer putInt(int v)
Puts/Gets an integer into the buffer at the current position.
-
getInt
public int getInt()
-
putByte
public ByteBuffer putByte(byte v)
Puts/Gets a byte into the buffer at the current position.
-
getByte
public byte getByte()
-
putShort
public ByteBuffer putShort(short v)
Puts/Gets a short into the buffer at the current position.
-
getShort
public short getShort()
-
-