public class ByteArrayRandomAccessBuffer extends java.lang.Object implements LockableRandomAccessBuffer, java.io.Serializable
LockableRandomAccessBuffer.RAFLock
Modifier | Constructor and Description |
---|---|
protected |
ByteArrayRandomAccessBuffer() |
|
ByteArrayRandomAccessBuffer(byte[] padded) |
|
ByteArrayRandomAccessBuffer(byte[] initialContents,
int offset,
int size,
boolean readOnly) |
|
ByteArrayRandomAccessBuffer(int size) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
free()
Free the underlying resources.
|
boolean |
isReadOnly() |
LockableRandomAccessBuffer.RAFLock |
lockOpen()
Keep the RAF open.
|
void |
onResume(ClientContext context)
Called on resuming, i.e.
|
void |
pread(long fileOffset,
byte[] buf,
int bufOffset,
int length)
Read a block of data from a specific location in the file.
|
void |
pwrite(long fileOffset,
byte[] buf,
int bufOffset,
int length) |
void |
setReadOnly() |
long |
size() |
void |
storeTo(java.io.DataOutputStream dos)
Write enough data to reconstruct the Bucket, or throw UnsupportedOperationException.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode
public ByteArrayRandomAccessBuffer(byte[] padded)
public ByteArrayRandomAccessBuffer(int size)
public ByteArrayRandomAccessBuffer(byte[] initialContents, int offset, int size, boolean readOnly)
protected ByteArrayRandomAccessBuffer()
public void close()
close
in interface RandomAccessBuffer
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void pread(long fileOffset, byte[] buf, int bufOffset, int length) throws java.io.IOException
RandomAccessBuffer
pread
in interface RandomAccessBuffer
fileOffset
- The offset within the file to read from.buf
- The buffer to write to.bufOffset
- The offset within the buffer to the first read byte.length
- The length of data to read.java.io.IOException
- If we were unable to read the required number of bytes etc.public void pwrite(long fileOffset, byte[] buf, int bufOffset, int length) throws java.io.IOException
pwrite
in interface RandomAccessBuffer
java.io.IOException
public long size()
size
in interface RandomAccessBuffer
public void setReadOnly()
public boolean isReadOnly()
public LockableRandomAccessBuffer.RAFLock lockOpen()
LockableRandomAccessBuffer
lockOpen
in interface LockableRandomAccessBuffer
public void free()
RandomAccessBuffer
free
in interface RandomAccessBuffer
public void onResume(ClientContext context)
LockableRandomAccessBuffer
onResume
in interface LockableRandomAccessBuffer
public void storeTo(java.io.DataOutputStream dos)
LockableRandomAccessBuffer
storeTo
in interface LockableRandomAccessBuffer