Constructor and Description |
---|
ByteRange(byte[] bytes)
Create a binary range from a byte array.
|
ByteRange(byte[] bytes,
int offset,
int limit)
Create a binary range from a subrange of a byte array.
|
ByteRange(ByteBuffer buffer)
Create a binary range from a byte buffer.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Get all data in this range
|
boolean |
getBytes(ByteBuffer target)
Read all data in this range to the provided buffer.
|
ByteRange |
getSubrange(long offset)
Build a subrange of this data range.
|
ByteRange |
getSubrange(long offset,
long length)
Build a subrange of this data range.
|
long |
length() |
void |
putBytes(byte[] block)
Put data at the beginning of this range.
|
void |
putBytes(ByteBufferView _buffer)
Put data from the provided buffer at the beginning of this range.
|
public ByteRange(byte[] bytes)
bytes
- Byte arraypublic ByteRange(byte[] bytes, int offset, int limit)
bytes
- Byte arrayoffset
- Offset in bytes
, inclusivelimit
- Limit in bytes
, exclusive; must not be larger than bytes.length
public ByteRange(ByteBuffer buffer)
public long length()
public ByteRange getSubrange(long offset, long length)
Range
getSubrange
in interface Range<ByteRange>
offset
- Offset from the beginning of the original data range in bytes, inclusivelength
- Length of the new data rangepublic ByteRange getSubrange(long offset)
Range
getSubrange
in interface Range<ByteRange>
offset
- Offset from the beginning of the original data range in bytes, inclusivepublic byte[] getBytes()
Range
public boolean getBytes(ByteBuffer target)
Range
public void putBytes(byte[] block)
Range
putBytes
in interface Range<ByteRange>
block
- Block of data with length less than or equal to Range.length()
of this rangepublic void putBytes(ByteBufferView _buffer)
Range
Copyright © 2016–2021. All rights reserved.