Class RangeBufferUnion<A>
java.lang.Object
org.aksw.commons.io.buffer.range.RangeBufferUnion<A>
- Type Parameters:
A-
- All Implemented Interfaces:
ArrayReadable<A>, ArrayWritable<A>, BufferLike<A>, HasArrayOps<A>, RangeBuffer<A>, ReadableChannelFactory<A>, ReadableChannelSource<A>, SeekableReadableChannelSource<A>
A union view of two buffers.
Writes go into the first one.
- Author:
- raven
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RangeBuffer<A> protected RangeBuffer<A> protected com.google.common.collect.RangeSet<Long> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> RangeBufferUnion<A> create(RangeBuffer<A> first, RangeBuffer<A> second) get(long index) longBuffers with 'unlimited' capacity should return Long.MAX_VALUEcom.google.common.collect.RangeSet<Long> getCoveredRanges(com.google.common.collect.Range<Long> localRange) Return a set of contributions by this buffer for the given lookup range While this method does not expose which parts of the global range are covered, this method allows to check whether there are any gaps in the readThe offset within the range set where this buffer starts; may be null if the offset cannot be represented in a single value such as in a union of two buffers which have different offsetscom.google.common.collect.RangeSet<Long> A set of ranges from which reading is valid.voidinttoString()voidThe method that needs to be implemented; all other methods default-delegate to this one.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ArrayReadable
newReadableChannel, readIntoRaw, sizeMethods inherited from interface ArrayWritable
write, writeMethods inherited from interface RangeBuffer
slice, transferFrom, transferToMethods inherited from interface SeekableReadableChannelSource
newReadableChannel, newReadableChannel, newReadableChannel
-
Field Details
-
first
-
second
-
unionRanges
-
-
Constructor Details
-
RangeBufferUnion
-
-
Method Details
-
create
-
write
public void write(long offsetInBuffer, A arrayWithItemsOfTypeT, int arrOffset, int arrLength) throws IOException Description copied from interface:ArrayWritableThe method that needs to be implemented; all other methods default-delegate to this one.- Specified by:
writein interfaceArrayWritable<A>- Throws:
IOException
-
put
- Specified by:
putin interfaceArrayWritable<A>
-
getArrayOps
- Specified by:
getArrayOpsin interfaceHasArrayOps<A>
-
getCoveredRanges
public com.google.common.collect.RangeSet<Long> getCoveredRanges(com.google.common.collect.Range<Long> localRange) Description copied from interface:RangeBufferReturn a set of contributions by this buffer for the given lookup range While this method does not expose which parts of the global range are covered, this method allows to check whether there are any gaps in the read- Specified by:
getCoveredRangesin interfaceRangeBuffer<A>
-
readInto
- Specified by:
readIntoin interfaceArrayReadable<A>- Throws:
IOException
-
get
- Specified by:
getin interfaceArrayReadable<A>
-
getCapacity
public long getCapacity()Description copied from interface:BufferLikeBuffers with 'unlimited' capacity should return Long.MAX_VALUE- Specified by:
getCapacityin interfaceBufferLike<A>
-
getRanges
Description copied from interface:RangeBufferA set of ranges from which reading is valid. The range set may be shared among several range buffers and may thus include ranges outside of the range formed by the buffer's offset and capacity- Specified by:
getRangesin interfaceRangeBuffer<A>
-
getOffsetInRanges
Description copied from interface:RangeBufferThe offset within the range set where this buffer starts; may be null if the offset cannot be represented in a single value such as in a union of two buffers which have different offsets- Specified by:
getOffsetInRangesin interfaceRangeBuffer<A>
-
toString
-
getBackingBuffer
- Specified by:
getBackingBufferin interfaceRangeBuffer<A>
-