Class ByteBufferLongBigList

All Implemented Interfaces:
BigList<Long>, LongBigList, LongCollection, LongIterable, LongStack, Size64, Stack<Long>, FlyweightPrototype<ByteBufferLongBigList>, Comparable<BigList<? extends Long>>, Iterable<Long>, Collection<Long>

@Deprecated public class ByteBufferLongBigList extends AbstractLongBigList implements FlyweightPrototype<ByteBufferLongBigList>
Use LongMappedBigList instead.
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 MappedByteBuffers, each mapping a chunk of CHUNK_SIZE longs.

Instances of this class are not thread safe, but the copy() method provides a lightweight duplicate that can be accessed independently by another thread. Only chunks that are actually used will be duplicated lazily.

Sebastiano Vigna
  • Field Details

  • Constructor Details

    • ByteBufferLongBigList

      public ByteBufferLongBigList(ByteBuffer byteBuffer)
      Creates a new byte-buffer long big list from a single ByteBuffer.
      byteBuffer - the underlying byte buffer.
    • ByteBufferLongBigList

      protected ByteBufferLongBigList(ByteBuffer[] byteBuffer, long size, boolean[] readyToUse)
      Creates a new byte-buffer long big list.
      byteBuffer - the underlying byte buffers.
      size - the overall number of longs in 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.
  • Method Details