Class SizedObjectChunk<T,ATTR extends Any>

java.lang.Object
io.deephaven.chunk.sized.SizedObjectChunk<T,ATTR>
Type Parameters:
ATTR - the chunk's attribute
All Implemented Interfaces:
SafeCloseable, AutoCloseable

public final class SizedObjectChunk<T,ATTR extends Any> extends Object implements SafeCloseable
A wrapper for a Object chunk that allows you to resize the chunk to a capacity.
  • Constructor Details

    • SizedObjectChunk

      public SizedObjectChunk()
    • SizedObjectChunk

      public SizedObjectChunk(int initialSize)
  • Method Details

    • get

      @Nullable public @Nullable WritableObjectChunk<T,ATTR> get()
      Get the underlying chunk.
      Returns:
      the underlying chunk. May be null if the chunk has not been initialized.
    • ensureCapacity

      public WritableObjectChunk<T,ATTR> ensureCapacity(int capacity)
      Ensure the underlying chunk has a capacity of at least capacity, preserving data. The data and size of the returned chunk are undefined. If you must maintain the data, then use ensureCapacityPreserve(int).
      Parameters:
      capacity - the minimum capacity for the chunk.
      Returns:
      the underlying chunk
    • ensureCapacityPreserve

      public WritableObjectChunk<T,ATTR> ensureCapacityPreserve(int capacity)
      Ensure the underlying chunk has a capacity of at least capacity. If the chunk has existing data, then it is copied to the new chunk. If the underlying chunk already exists, then the size of the chunk is the original size. If the chunk did not exist, then the size of the returned chunk is zero.
      Parameters:
      capacity - the minimum capacity for the chunk.
      Returns:
      the underlying chunk
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SafeCloseable