public class ReadOnlyRandomAccessBuffer extends java.lang.Object implements LockableRandomAccessBuffer
LockableRandomAccessBuffer.RAFLock
Constructor and Description |
---|
ReadOnlyRandomAccessBuffer(java.io.DataInputStream dis,
FilenameGenerator fg,
PersistentFileTracker persistentFileTracker,
MasterSecret masterSecret) |
ReadOnlyRandomAccessBuffer(LockableRandomAccessBuffer underlying) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
equals(java.lang.Object obj)
Must reimplement equals().
|
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) |
long |
size() |
void |
storeTo(java.io.DataOutputStream dos)
Write enough data to reconstruct the Bucket, or throw UnsupportedOperationException.
|
public ReadOnlyRandomAccessBuffer(LockableRandomAccessBuffer underlying)
public ReadOnlyRandomAccessBuffer(java.io.DataInputStream dis, FilenameGenerator fg, PersistentFileTracker persistentFileTracker, MasterSecret masterSecret) throws java.io.IOException, StorageFormatException, ResumeFailedException
java.io.IOException
StorageFormatException
ResumeFailedException
public long size()
size
in interface RandomAccessBuffer
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 void close()
close
in interface RandomAccessBuffer
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void free()
RandomAccessBuffer
free
in interface RandomAccessBuffer
public LockableRandomAccessBuffer.RAFLock lockOpen() throws java.io.IOException
LockableRandomAccessBuffer
lockOpen
in interface LockableRandomAccessBuffer
java.io.IOException
public void onResume(ClientContext context) throws ResumeFailedException
LockableRandomAccessBuffer
onResume
in interface LockableRandomAccessBuffer
ResumeFailedException
public void storeTo(java.io.DataOutputStream dos) throws java.io.IOException
LockableRandomAccessBuffer
storeTo
in interface LockableRandomAccessBuffer
java.io.IOException
public int hashCode()
LockableRandomAccessBuffer
hashCode
in interface LockableRandomAccessBuffer
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
LockableRandomAccessBuffer
equals
in interface LockableRandomAccessBuffer
equals
in class java.lang.Object