-
- All Implemented Interfaces:
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 and return true if it is found to be invalid. abstract voidreadRegionToBuff(int off, int len, Array<byte> outBuf)Copies lenbytes from the given offset in this buffer to the givenoutBufabstract voidgrow(int howMuch)Increases the size of this buffer by howMuch.abstract voidappend(Array<byte> data, int len)Appends lenbytes fromdatato the end of this buffer.abstract voidshrink(int len)Shrinks the length of this buffer by 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 and return true if it is found to be invalid.
-
readRegionToBuff
abstract void readRegionToBuff(int off, int len, Array<byte> outBuf)
Copies
lenbytes from the given offset in this buffer to the givenoutBuf- 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
howMuch. This may result in a newbyte[]to be allocated if the existing one is not large enough.
-
append
abstract void append(Array<byte> data, int len)
Appends
lenbytes fromdatato the end of this buffer. This grows the buffer and as a result a newbyte[]may be allocated.
-
shrink
abstract void shrink(int len)
Shrinks the length of this buffer by
len
-
-
-
-