public class ByteBufferLongBigList extends AbstractLongBigList
Java's memory-mapping facilities have
the severe limitation of mapping at most Integer.MAX_VALUE bytes, as they
expose the content of a file using a MappedByteBuffer. This class can expose
a file of longs of arbitrary length as a LongBigList
that is actually based on an array of MappedByteBuffers, each mapping
a chunk of CHUNK_SIZE longs.
AbstractLongBigList.LongSubList| Modifier and Type | Field and Description |
|---|---|
static long |
CHUNK_SIZE
The size in longs of a chunk created by
map(FileChannel, ByteOrder, FileChannel.MapMode). |
| Modifier | Constructor and Description |
|---|---|
|
ByteBufferLongBigList(ByteBuffer byteBuffer)
Creates a new byte-buffer long big list from a single
ByteBuffer. |
protected |
ByteBufferLongBigList(ByteBuffer[] byteBuffer,
long size,
boolean[] readyToUse)
Creates a new byte-buffer long big list.
|
| Modifier and Type | Method and Description |
|---|---|
ByteBufferLongBigList |
copy() |
long |
getLong(long index) |
static ByteBufferLongBigList |
map(FileChannel fileChannel)
Creates a new byte-buffer long big list by read-only mapping a given file channel using the standard Java (i.e.,
DataOutput) byte order (ByteOrder.BIG_ENDIAN). |
static ByteBufferLongBigList |
map(FileChannel fileChannel,
ByteOrder byteOrder)
Creates a new byte-buffer long big list by read-only mapping a given file channel.
|
static ByteBufferLongBigList |
map(FileChannel fileChannel,
ByteOrder byteOrder,
FileChannel.MapMode mapMode)
Creates a new byte-buffer long big list by mapping a given file channel.
|
long |
size64() |
add, add, add, addAll, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, get, getElements, getLong, hashCode, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, listIterator, peek, peekLong, pop, popLong, push, push, rem, remove, remove, removeElements, removeLong, removeLong, set, set, set, size, size, size, subList, top, topLong, toStringadd, contains, containsAll, containsAll, isEmpty, longIterator, rem, remove, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArrayclearclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, longIterator, removeAll, retainAll, toArray, toArray, toLongArray, toLongArrayadd, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArraypublic static final long CHUNK_SIZE
map(FileChannel, ByteOrder, FileChannel.MapMode).public ByteBufferLongBigList(ByteBuffer byteBuffer)
ByteBuffer.byteBuffer - the underlying byte buffer.protected ByteBufferLongBigList(ByteBuffer[] byteBuffer, long size, boolean[] readyToUse)
byteBuffer - the underlying byte buffers.size - the overall number of longs in the the underlying byte buffers (i.e., the
sum of the capacities of the byte buffers divided by eight).readyToUse - an array parallel to byteBuffer specifying which buffers do not need to be
duplicated before being used (the process will happen lazily); the array
will be used internally by the newly created byte-buffer long big list.public static ByteBufferLongBigList map(FileChannel fileChannel) throws IOException
DataOutput) byte order (ByteOrder.BIG_ENDIAN).fileChannel - the file channel that will be mapped.fileChannel.IOExceptionpublic static ByteBufferLongBigList map(FileChannel fileChannel, ByteOrder byteOrder) throws IOException
fileChannel - the file channel that will be mapped.byteOrder - a prescribed byte order.fileChannel.IOExceptionpublic static ByteBufferLongBigList map(FileChannel fileChannel, ByteOrder byteOrder, FileChannel.MapMode mapMode) throws IOException
fileChannel - the file channel that will be mapped.byteOrder - a prescribed byte order.mapMode - this must be FileChannel.MapMode.READ_ONLY.fileChannel.IOExceptionpublic ByteBufferLongBigList copy()
public long getLong(long index)
public long size64()