-
public interface ByteArrayBufferA simple interface that encapsulates all the information needed for byte buffer access.
-
-
Method Summary
Modifier and Type Method Description abstract Array<byte>getBuffer()Gets the byte buffer that supports this instance. abstract intgetOffset()Gets the offset in the byte buffer where the actual data starts. abstract intgetLength()Gets the length of the data in the buffer. abstract voidsetLength(int len)Sets the length of the data in the buffer. abstract voidsetOffset(int off)Sets the offset of the data in the buffer. abstract booleanisInvalid()Perform checks on the byte buffer represented by this instance andreturn true if it is found to be invalid. abstract voidreadRegionToBuff(int off, int len, Array<byte> outBuf)Copies {@code len}bytes from the given offset in this buffer to the given{@code outBuf}abstract voidgrow(int howMuch)Increases the size of this buffer by {@code howMuch}.abstract voidappend(Array<byte> data, int len)Appends {@code len}bytes from{@code data}to the end of this buffer.abstract voidshrink(int len)Shrinks the length of this buffer by {@code len}-
-
Method Detail
-
getOffset
abstract int getOffset()
Gets the offset in the byte buffer where the actual data starts.
-
getLength
abstract int getLength()
Gets the length of the data in the buffer.
-
setLength
abstract void setLength(int len)
Sets the length of the data in the buffer.
- Parameters:
len- the length of the data in the buffer.
-
setOffset
abstract void setOffset(int off)
Sets the offset of the data in the buffer.
- Parameters:
off- the offset of the data in the buffer.
-
isInvalid
abstract boolean isInvalid()
Perform checks on the byte buffer represented by this instance andreturn true if it is found to be invalid.
-
readRegionToBuff
abstract void readRegionToBuff(int off, int len, Array<byte> outBuf)
Copies
{@code len}bytes from the given offset in this buffer to the given{@code outBuf}- Parameters:
off- the offset relative to the beginning of this buffer's data from where to start copying.len- the number of bytes to copy.outBuf- the array to copy to
-
grow
abstract void grow(int howMuch)
Increases the size of this buffer by
{@code howMuch}. This may result in a new{@code byte[]}to be allocatedif the existing one is not large enough.
-
append
abstract void append(Array<byte> data, int len)
Appends
{@code len}bytes from{@code data}to the end of this buffer. This grows the buffer and as a resulta new{@code byte[]}may be allocated.
-
shrink
abstract void shrink(int len)
Shrinks the length of this buffer by
{@code len}
-
-
-
-