public class LogInputStream extends InputStream
InputStream
Constructor and Description |
---|
LogInputStream(InputStream in,
int length)
Creates a log input file with the specified input stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns the number of bytes that can be read without blocking.
|
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.
|
mark, markSupported, reset
public LogInputStream(InputStream in, int length) throws IOException
in
- the input streamlength
- the total number of bytes allowed to be readIOException
- If an I/O error has occurred.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 readLogException
- 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 readLogException
- 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 skippedLogException
- 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 interface AutoCloseable
close
in class InputStream
protected void finalize() throws IOException
finalize
in class Object
IOException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.