public interface ByteBank
ByteBank
is a self-growing buffer over arbitrary bytes.Modifier and Type | Method and Description |
---|---|
default void |
appendBytes(byte[] bytes,
int length)
Appends the given bytes to the buffer
|
default void |
appendBytes(byte[] bytes,
int offset,
int length)
Appends the given bytes to the buffer
|
default void |
basicRangeCheck(long start,
long end)
Ensures that the requested range satisfies basic sanity criteria.
|
default void |
checkReadPos(long start,
long end)
Check if we can read from the specified range
|
default void |
checkWritePos(long start,
long end)
Check if we can write to the specified range
|
void |
clear()
Clears the buffer
|
byte |
getByte(long pos) |
default int |
getBytes(long startPos,
byte[] bytes) |
int |
getBytes(long startPos,
byte[] bytes,
int offset,
int length) |
long |
getMaxBufferSize() |
default boolean |
isReadOnly() |
void |
setByte(long pos,
byte b)
Sets the byte at the given position
|
void |
setBytes(long startPos,
byte[] bytes,
int offset,
int length)
Sets the bytes starting form the given position to the values form the
provided array.
|
long |
size() |
default byte[] |
toByteArray()
Copies this entire buffer into a newly allocated byte array.
|
default byte[] |
toByteArray(long offset,
int len)
Copies part of this buffer into a newly allocated byte array.
|
byte getByte(long pos)
pos
- the position to read fromdefault int getBytes(long startPos, byte[] bytes)
startPos
- the position in the buffer to start reading frombytes
- the byte array to read intoint getBytes(long startPos, byte[] bytes, int offset, int length)
startPos
- the position in the buffer to start reading frombytes
- the byte array to read intooffset
- the offset in the bytes arraylength
- the number of elements to read into the bytes arraydefault byte[] toByteArray(long offset, int len)
offset
- the initial position in the bufferlen
- the number of bytes to copydefault byte[] toByteArray()
void setBytes(long startPos, byte[] bytes, int offset, int length)
startPos
- the position in the buffer to start writing frombytes
- the byte array to writeoffset
- the offset in the bytes arraylength
- the number of bytes to readdefault void appendBytes(byte[] bytes, int length)
bytes
- the array containing the bytes to append to the bufferlength
- the number of elements to append from the bytes arraydefault void appendBytes(byte[] bytes, int offset, int length)
bytes
- the array containing the bytes to append to the bufferoffset
- the offset in the bytes arraylength
- the number of elements to append from the bytes arraydefault void checkReadPos(long start, long end)
start
- the start position of the rangeend
- the end position of the rangedefault void checkWritePos(long start, long end)
start
- the start position of the rangeend
- the end position of the rangeIndexOutOfBoundsException
- ifdefault void basicRangeCheck(long start, long end)
start
- the start of the rangeend
- the end of the rangevoid clear()
long size()
void setByte(long pos, byte b)
pos
- the positionb
- the value to setlong getMaxBufferSize()
default boolean isReadOnly()
Copyright © 2015–2022 SciJava. All rights reserved.