Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public abstract class AbstractPersistentBlockBuffer extends Object implements PersistentBlockBuffer
PersistentBuffer
as a set of allocatable blocks.| Modifier and Type | Field and Description |
|---|---|
protected PersistentBuffer |
pbuffer |
| Constructor and Description |
|---|
AbstractPersistentBlockBuffer(PersistentBuffer pbuffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
barrier(boolean force)
Ensures that all writes before this barrier occur before all writes after
this barrier.
|
void |
close()
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.
|
InputStream |
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.
|
OutputStream |
getOutputStream(long id,
long offset,
long length)
Gets an output stream that writes to this buffer.
|
ProtectionLevel |
getProtectionLevel()
Gets the protection level currently implemented by the buffer.
|
boolean |
isClosed()
Checks if this buffer is closed.
|
protected boolean |
isInBounds(long id,
long offset,
long len)
Checks that a request is within the bounds of the block.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallocate, deallocate, getBlockSize, iterateBlockIdsprotected final PersistentBuffer pbuffer
public AbstractPersistentBlockBuffer(PersistentBuffer pbuffer)
public boolean isClosed()
PersistentBlockBufferisClosed in interface PersistentBlockBufferpublic void close()
throws IOException
PersistentBlockBufferclose in interface PersistentBlockBufferIOExceptionpublic ProtectionLevel getProtectionLevel()
PersistentBlockBuffergetProtectionLevel in interface PersistentBlockBufferPersistentBlockBuffer.barrier(boolean)public void barrier(boolean force)
throws IOException
PersistentBlockBufferforce is true, will also
commit to physical media synchronously before returning. This request
may be ignored or force downgraded to barrier-only depending on the current
protection level.barrier in interface PersistentBlockBufferIOExceptionPersistentBlockBuffer.getProtectionLevel()protected boolean isInBounds(long id,
long offset,
long len)
throws IOException
IOExceptionpublic void get(long id,
long offset,
byte[] buff,
int off,
int len)
throws IOException
PersistentBlockBufferget in interface PersistentBlockBufferIOExceptionpublic int getInt(long id,
long offset)
throws IOException
PersistentBlockBuffergetInt in interface PersistentBlockBufferIOExceptionpublic long getLong(long id,
long offset)
throws IOException
PersistentBlockBuffergetLong in interface PersistentBlockBufferIOExceptionpublic InputStream getInputStream(long id, long offset, long length) throws IOException
PersistentBlockBuffergetInputStream in interface PersistentBlockBufferIOExceptionpublic void put(long id,
long offset,
byte[] buff,
int off,
int len)
throws IOException
PersistentBlockBufferput in interface PersistentBlockBufferIOExceptionpublic void putInt(long id,
long offset,
int value)
throws IOException
PersistentBlockBufferputInt in interface PersistentBlockBufferIOExceptionpublic void putLong(long id,
long offset,
long value)
throws IOException
PersistentBlockBufferputLong in interface PersistentBlockBufferIOExceptionpublic OutputStream getOutputStream(long id, long offset, long length) throws IOException
PersistentBlockBuffergetOutputStream in interface PersistentBlockBufferIOExceptionprotected abstract long getBlockAddress(long id)
throws IOException
IOExceptionprotected abstract void ensureCapacity(long capacity)
throws IOException
IOExceptionCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.