public class DatastoreRandomAccessStream extends RandomAccessStream implements LockableStream
Constructor and Description |
---|
DatastoreRandomAccessStream(DatastoreRandomAccessFile file) |
Modifier and Type | Method and Description |
---|---|
void |
closeImpl()
Closes the stream.
|
long |
getFilePointer()
Returns the current position of the file pointer.
|
java.io.InputStream |
getInputStream()
Returns an InputStream for this stream.
|
long |
getLength()
Returns the length.
|
java.io.OutputStream |
getOutputStream()
Returns an OutputStream for this stream.
|
DatastoreRandomAccessFile |
getRandomAccessFile() |
boolean |
lock(boolean shared,
boolean block)
Lock the shared advisory lock.
|
int |
read()
Read a byte from the file, advancing the pointer.
|
int |
read(byte[] buffer,
int offset,
int length)
Reads a block starting from the current file pointer.
|
int |
read(char[] buffer,
int offset,
int length)
Reads a block starting from the current file pointer.
|
int |
read(long fileOffset,
byte[] buffer,
int offset,
int length)
Reads a block from a given location.
|
boolean |
seek(long position)
Seeks to the given position in the file.
|
boolean |
unlock()
Unlock the advisory lock.
|
void |
write(byte[] buffer,
int offset,
int length)
Writes a block starting from the current file pointer.
|
void |
write(int b)
Write a byte to the file, advancing the pointer.
|
void |
write(long fileOffset,
byte[] buffer,
int offset,
int length)
Writes a block from a given location.
|
allocate, close, free, fsync, getMmapAddress, getUseCount, isMmap, isOpen, writeToStream
public DatastoreRandomAccessStream(DatastoreRandomAccessFile file)
public DatastoreRandomAccessFile getRandomAccessFile()
public long getLength() throws java.io.IOException
getLength
in class RandomAccessStream
java.io.IOException
public int read(byte[] buffer, int offset, int length) throws java.io.IOException
read
in class RandomAccessStream
java.io.IOException
public int read(char[] buffer, int offset, int length) throws java.io.IOException
read
in class RandomAccessStream
java.io.IOException
public int read(long fileOffset, byte[] buffer, int offset, int length) throws java.io.IOException
read
in class RandomAccessStream
java.io.IOException
public void write(byte[] buffer, int offset, int length) throws java.io.IOException
write
in class RandomAccessStream
java.io.IOException
public void write(long fileOffset, byte[] buffer, int offset, int length) throws java.io.IOException
write
in class RandomAccessStream
java.io.IOException
public boolean seek(long position)
seek
in class RandomAccessStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in class RandomAccessStream
java.io.IOException
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in class RandomAccessStream
java.io.IOException
public int read() throws java.io.IOException
read
in class RandomAccessStream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class RandomAccessStream
java.io.IOException
public long getFilePointer() throws java.io.IOException
getFilePointer
in class RandomAccessStream
java.io.IOException
public void closeImpl() throws java.io.IOException
closeImpl
in class RandomAccessStream
java.io.IOException
public boolean lock(boolean shared, boolean block)
LockableStream
lock
in interface LockableStream
lock
in class RandomAccessStream
public boolean unlock()
LockableStream
unlock
in interface LockableStream
unlock
in class RandomAccessStream