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