public class SynchronizedRange<T extends Range<T>> extends Object implements Range<T>, DelegatingRange<T>
Constructor and Description |
---|
SynchronizedRange(Range<T> delegate)
Create a data range synchronized with a private lock.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Get all data in this range
|
boolean |
getBytes(ByteBuffer buffer)
Read all data in this range to the provided buffer.
|
T |
getDelegate() |
protected ReadWriteLock |
getLock() |
SynchronizedRange<T> |
getSubrange(long offset)
Build a subrange of this data range.
|
SynchronizedRange<T> |
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 long length()
public SynchronizedRange<T> getSubrange(long offset, long length)
getSubrange
in interface Range<T extends Range<T>>
offset
- Offset from the beginning of the original data range in bytes, inclusivelength
- Length of the new data rangepublic SynchronizedRange<T> getSubrange(long offset)
getSubrange
in interface Range<T extends Range<T>>
offset
- Offset from the beginning of the original data range in bytes, inclusivepublic byte[] getBytes()
public boolean getBytes(ByteBuffer buffer)
Range
public void putBytes(byte[] block)
public void putBytes(ByteBufferView buffer)
Range
protected ReadWriteLock getLock()
public T getDelegate()
getDelegate
in interface DelegatingRange<T extends Range<T>>
Copyright © 2016–2021. All rights reserved.