Top Description Fields Constructors Methods
com.amazon.ion.impl.bin

pack-priv abstract Class Block

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable

An abstraction for a block of managed memory. A Block is acquired by a caller via BlockAllocator#allocateBlock() and released by close().

This class and its implementations are not thread-safe.

Field Summary

Modifier and TypeField and Description
public final byte[]
data

The data backing this block.

public int
limit

The first index for which data has not been written to or read from.

Constructor Summary

AccessConstructor and Description
pack-priv
Block(final byte[] data)

Method Summary

Modifier and TypeMethod and Description
public final int
capacity()

Returns the underlying data array's capacity.

public abstract void
close()

Redeclares java.io.Closeable.close.

Releases the block back to the BlockAllocator from whence it was allocated from.

public final int
remaining()

Returns the unused amount of bytes from the limit to the capacity of the data array.

public final void
reset()

Resets the limit to zero.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
public final byte[] data

The data backing this block.

limitback to summary
public int limit

The first index for which data has not been written to or read from.

Constructor Detail

Blockback to summary
pack-priv Block(final byte[] data)

Method Detail

capacityback to summary
public final int capacity()

Returns the underlying data array's capacity.

closeback to summary
public abstract void close()

Redeclares java.io.Closeable.close.

Releases the block back to the BlockAllocator from whence it was allocated from. This method must be called when the block is no longer needed. This is used to allow underlying resources to be reclaimed and/or released properly.

remainingback to summary
public final int remaining()

Returns the unused amount of bytes from the limit to the capacity of the data array.

resetback to summary
public final void reset()

Resets the limit to zero.