|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.sun.jini.reliableLog.LogInputStream
public class LogInputStream
This class extends the functionality of the java.io.InputStream class in order to provide an input mechanism that can be used by processes that perform logging operations; in particular, processes that store state in order to provide persistence.
InputStream
Field Summary | |
---|---|
private InputStream |
in
|
private int |
length
|
Constructor Summary | |
---|---|
LogInputStream(InputStream in,
int length)
Creates a log input file with the specified input stream. |
Method Summary | |
---|---|
int |
available()
Returns the number of bytes that can be read without blocking. |
private void |
badRead(int numBytes)
Throw exception for reading past end of log record. |
void |
close()
Closes the input stream. |
protected void |
finalize()
Closes the stream when garbage is collected. |
int |
read()
Reads a byte of data. |
int |
read(byte[] b)
Reads data into an array of bytes. |
int |
read(byte[] b,
int off,
int len)
Reads data into an array of bytes. |
long |
skip(long n)
Skips n bytes of input. |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private InputStream in
private int length
Constructor Detail |
---|
public LogInputStream(InputStream in, int length) throws IOException
in
- the input streamlength
- the total number of bytes allowed to be read
IOException
- If an I/O error has occurred.Method Detail |
---|
private void badRead(int numBytes) throws LogException
numBytes
- number of bytes attempted to be read
LogException
- Attempt to read past end of log.public int read() throws IOException, LogException
read
in class InputStream
LogException
- Attempt to read past end of log.
IOException
- If an I/O error has occurred.public int read(byte[] b) throws IOException, LogException
read
in class InputStream
b
- the buffer into which the data is read
LogException
- Attempt to read past end of log.
IOException
- If an I/O error has occurred.public int read(byte[] b, int off, int len) throws IOException, LogException
read
in class InputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
LogException
- Attempt to read past end of log.
IOException
- If an I/O error has occurred.public long skip(long n) throws IOException, LogException
skip
in class InputStream
n
- the number of bytes to be skipped
LogException
- Attempt to read past end of log.
IOException
- If an I/O error has occurred.public int available()
available
in class InputStream
public void close()
close
in interface Closeable
close
in class InputStream
protected void finalize() throws IOException
finalize
in class Object
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |