it.unimi.dsi.util
Class ByteBufferLongBigList
java.lang.Object
java.util.AbstractCollection<Long>
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongBigList
it.unimi.dsi.util.ByteBufferLongBigList
- All Implemented Interfaces:
- BigList<Long>, LongBigList, LongCollection, LongIterable, LongStack, Size64, Stack<Long>, Comparable<BigList<? extends Long>>, Iterable<Long>, Collection<Long>
public class ByteBufferLongBigList
- extends AbstractLongBigList
A bridge between byte buffers and long big lists.
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 MappedByteBuffer
s, each mapping
a chunk of CHUNK_SIZE
longs.
- Author:
- Sebastiano Vigna
Field Summary |
static long |
CHUNK_SIZE
The size in longs of a chunk created by #map(FileChannel, ByteOrder, MapMode) . |
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongBigList |
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, toString |
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection |
add, contains, containsAll, containsAll, isEmpty, longIterator, rem, remove, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArray |
Methods inherited from interface it.unimi.dsi.fastutil.Stack |
isEmpty |
CHUNK_SIZE
public static final long CHUNK_SIZE
- The size in longs of a chunk created by
#map(FileChannel, ByteOrder, MapMode)
.
ByteBufferLongBigList
public ByteBufferLongBigList(ByteBuffer byteBuffer)
- Creates a new byte-buffer long big list from a single
ByteBuffer
.
- Parameters:
byteBuffer
- the underlying byte buffer.
ByteBufferLongBigList
protected ByteBufferLongBigList(ByteBuffer[] byteBuffer,
long size,
boolean[] readyToUse)
- Creates a new byte-buffer long big list.
- Parameters:
byteBuffer
- the underlying byte buffers.size
- the sum of the capacities of the byte buffers.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.
map
public static ByteBufferLongBigList map(FileChannel fileChannel,
ByteOrder byteOrder,
FileChannel.MapMode mapMode)
throws IOException
- Creates a new byte-buffer long big list by mapping a given file channel.
- Parameters:
fileChannel
- the file channel that will be mapped.byteOrder
- a prescribed byte order.mapMode
- this must be FileChannel.MapMode.READ_ONLY
.
- Returns:
- a new byte-buffer long big list over the contents of
fileChannel
.
- Throws:
IOException
copy
public ByteBufferLongBigList copy()
getLong
public long getLong(long index)
size64
public long size64()