Class BufferWithPages<A>
java.lang.Object
org.aksw.commons.io.buffer.plain.BufferWithPages<A>
- Type Parameters:
T-
- All Implemented Interfaces:
ArrayReadable<A>, ArrayWritable<A>, BufferLike<A>, HasArrayOps<A>, Buffer<A>, ReadableChannelFactory<A>, ReadableChannelSource<A>, SeekableReadableChannelSource<A>
A buffer backed by a mapping of page indices (longs) to arrays. All arrays are the same size.
The purpose of this class is to provide a tradeoff between for frequent consecutive small inserts at sparse locations.
The map accounts for sparseness, whereas consecutive small inserts will usually update the same array.
- Author:
- raven
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> BufferWithPages<A> get(long index) longBuffers with 'unlimited' capacity should return Long.MAX_VALUEvoidintvoidThe 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, toString, wait, wait, waitMethods inherited from interface ArrayReadable
newReadableChannel, readIntoRaw, sizeMethods inherited from interface ArrayWritable
write, writeMethods inherited from interface SeekableReadableChannelSource
newReadableChannel, newReadableChannel, newReadableChannel
-
Field Details
-
arrayOps
-
pageSize
protected int pageSize -
capacity
protected long capacity -
map
-
-
Constructor Details
-
BufferWithPages
-
BufferWithPages
-
-
Method Details
-
getArrayOps
- Specified by:
getArrayOpsin interfaceHasArrayOps<A>
-
getPageMap
-
create
-
write
Description copied from interface:ArrayWritableThe method that needs to be implemented; all other methods default-delegate to this one.- Specified by:
writein interfaceArrayWritable<A>
-
readInto
- Specified by:
readIntoin interfaceArrayReadable<A>
-
getCapacity
public long getCapacity()Description copied from interface:BufferLikeBuffers with 'unlimited' capacity should return Long.MAX_VALUE- Specified by:
getCapacityin interfaceBufferLike<A>
-
get
- Specified by:
getin interfaceArrayReadable<A>
-
put
- Specified by:
putin interfaceArrayWritable<A>
-