|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.common.io.BufferedFileDataInput
public class BufferedFileDataInput
Merges the capabilities of the following stream classes into a single class: FileInputStream, BufferedInputStream, and DataInputStream. This allows us to manage buffered data reads from files efficiently.
| Constructor Summary | |
|---|---|
BufferedFileDataInput(java.io.File file)
Creates instance with default buffer size. |
|
BufferedFileDataInput(java.io.File file,
int size)
Creates instance positioned on start of file. |
|
| Method Summary | |
|---|---|
long |
available()
Query the stream directly for the number of bytes available for immediate read without blocking. |
void |
close()
Close and release all resources. |
long |
getOffset()
Returns the current offset position. |
void |
mark(int readLimit)
Mark stream to read up to limit. |
byte |
readByte()
Reads a single byte. |
void |
readFully(byte[] bytes)
Reads a full byte array completely. |
void |
readFully(byte[] bytes,
int start,
int len)
Reads a full byte array completely. |
int |
readInt()
Read a single integer. |
long |
readLong()
Reads a single long. |
short |
readShort()
Reads a single short. |
void |
reset()
Reset stream back to last mark. |
void |
seek(long seekBytes)
Seek to a specific offset in the file. |
long |
skip(long bytes)
Skip requested number of bytes. |
java.lang.String |
toString()
Print contents of the reader. |
long |
waitAvailable(int requested,
int waitMillis)
Waits for a specified number of bytes to be available for a non-blocking read. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BufferedFileDataInput(java.io.File file,
int size)
throws java.io.FileNotFoundException,
java.io.IOException,
java.lang.InterruptedException
file - File from which to readsize - Size of buffer for buffered I/O
java.io.FileNotFoundException
java.io.IOException
java.lang.InterruptedException
public BufferedFileDataInput(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException,
java.lang.InterruptedException
java.io.FileNotFoundException
java.io.IOException
java.lang.InterruptedException| Method Detail |
|---|
public long getOffset()
public long available()
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public long waitAvailable(int requested,
int waitMillis)
throws java.io.IOException,
java.lang.InterruptedException
requested - Number of bytes to readwaitMillis - Milliseconds to wait before timeout
java.io.IOException - Thrown if there is a problem checking for available
bytes
java.lang.InterruptedException - Thrown if we are interrupted while waitingpublic void mark(int readLimit)
readLimit - Number of bytes that may be read before resetting
public void reset()
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOException - Thrown if mark has been invalidated or not set
java.lang.InterruptedException - Thrown if we are interrupted
public long skip(long bytes)
throws java.io.IOException
bytes - Number of bytes to skip
java.io.IOException - Thrown if seek not supported or other error
public void seek(long seekBytes)
throws java.io.FileNotFoundException,
java.io.IOException,
java.lang.InterruptedException
seekBytes - Number of bytes from start of file
java.io.IOException - Thrown if offset cannot be found
java.io.FileNotFoundException - Thrown if file is not found
java.lang.InterruptedException - Thrown if thread is interrupted
public byte readByte()
throws java.io.IOException
java.io.IOException
public short readShort()
throws java.io.IOException
java.io.IOException
public int readInt()
throws java.io.IOException
java.io.IOException
public long readLong()
throws java.io.IOException
java.io.IOException
public void readFully(byte[] bytes)
throws java.io.IOException
java.io.IOException - Thrown if full byte array cannot be read
public void readFully(byte[] bytes,
int start,
int len)
throws java.io.IOException
bytes - Buffer into which to readstart - Starting byte positionlen - Number of bytes to read
java.io.IOException - Thrown if data cannot be readpublic void close()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||