Class AbstractPersistentBlockBuffer

java.lang.Object
com.aoapps.persistence.AbstractPersistentBlockBuffer
All Implemented Interfaces:
PersistentBlockBuffer, Closeable, AutoCloseable
Direct Known Subclasses:
DynamicPersistentBlockBuffer, FixedPersistentBlockBuffer

public abstract class AbstractPersistentBlockBuffer extends Object implements PersistentBlockBuffer
Base class for any implementation that treats a PersistentBuffer as a set of allocatable blocks.
Author:
AO Industries, Inc.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final PersistentBuffer
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    barrier(boolean force)
    Ensures that all writes before this barrier occur before all writes after this barrier.
    protected void
    checkBounds(long id, long offset, long len)
    Checks that a request is within the bounds of the block.
    void
    Closes this buffer.
    protected abstract void
    ensureCapacity(long capacity)
    Ensures the underlying persistent buffer is of adequate capacity.
    void
    get(long id, long offset, byte[] buff, int off, int len)
    Gets bytes from this block.
    protected abstract long
    getBlockAddress(long id)
    Gets the address of the block in the underlying persistent buffer.
    getInputStream(long id, long offset, long length)
    Gets an input stream that reads from this buffer.
    int
    getInt(long id, long offset)
    Gets an integer from this block.
    long
    getLong(long id, long offset)
    Gets a long from this block.
    getOutputStream(long id, long offset, long length)
    Gets an output stream that writes to this buffer.
    Gets the protection level currently implemented by the buffer.
    boolean
    Checks if this buffer is closed.
    void
    put(long id, long offset, byte[] buff, int off, int len)
    Puts bytes to this block.
    void
    putInt(long id, long offset, int value)
    Puts an integer to this block.
    void
    putLong(long id, long offset, long value)
    Puts a long to this block.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.aoapps.persistence.PersistentBlockBuffer

    allocate, deallocate, getBlockSize, iterateBlockIds