public class PooledFileRandomAccessBuffer extends java.lang.Object implements LockableRandomAccessBuffer, java.io.Serializable
LockableRandomAccessBuffer.RAFLock| Modifier and Type | Field and Description |
|---|---|
java.io.File |
file |
| Modifier | Constructor and Description |
|---|---|
protected |
PooledFileRandomAccessBuffer() |
|
PooledFileRandomAccessBuffer(java.io.File file,
boolean readOnly,
long forceLength,
java.util.Random seedRandom,
long persistentTempID,
boolean deleteOnFree)
Create a RAF backed by a file.
|
|
PooledFileRandomAccessBuffer(java.io.File file,
java.lang.String mode,
byte[] initialContents,
int offset,
int size,
long persistentTempID,
boolean deleteOnFree,
boolean readOnly) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
closeRAF()
Exposed for tests only.
|
boolean |
equals(java.lang.Object obj)
Must reimplement equals() as two PooledRAFWrapper's could well be the same storage object
i.e.
|
void |
free()
Free the underlying resources.
|
int |
hashCode()
Must reimplement hashCode() if we change equals().
|
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 |
setSecureDelete(boolean secureDelete) |
long |
size() |
void |
storeTo(java.io.DataOutputStream dos)
Write enough data to reconstruct the Bucket, or throw UnsupportedOperationException.
|
java.lang.String |
toString() |
public PooledFileRandomAccessBuffer(java.io.File file,
boolean readOnly,
long forceLength,
java.util.Random seedRandom,
long persistentTempID,
boolean deleteOnFree)
throws java.io.IOException
file - readOnly - forceLength - seedRandom - persistentTempID - The tempfile ID, or -1.java.io.IOExceptionpublic PooledFileRandomAccessBuffer(java.io.File file,
java.lang.String mode,
byte[] initialContents,
int offset,
int size,
long persistentTempID,
boolean deleteOnFree,
boolean readOnly)
throws java.io.IOException
java.io.IOExceptionprotected PooledFileRandomAccessBuffer()
public long size()
size in interface RandomAccessBufferpublic void pread(long fileOffset,
byte[] buf,
int bufOffset,
int length)
throws java.io.IOException
RandomAccessBufferpread in interface RandomAccessBufferfileOffset - 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 RandomAccessBufferjava.io.IOExceptionpublic void close()
close in interface RandomAccessBufferclose in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic LockableRandomAccessBuffer.RAFLock lockOpen() throws java.io.IOException
LockableRandomAccessBufferlockOpen in interface LockableRandomAccessBufferjava.io.IOExceptionprotected void closeRAF()
public void setSecureDelete(boolean secureDelete)
public void free()
RandomAccessBufferfree in interface RandomAccessBufferpublic void onResume(ClientContext context) throws ResumeFailedException
LockableRandomAccessBufferonResume in interface LockableRandomAccessBufferResumeFailedExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void storeTo(java.io.DataOutputStream dos)
throws java.io.IOException
LockableRandomAccessBufferstoreTo in interface LockableRandomAccessBufferjava.io.IOExceptionpublic int hashCode()
LockableRandomAccessBufferhashCode in interface LockableRandomAccessBufferhashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in interface LockableRandomAccessBufferequals in class java.lang.Object