|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FilterInputStream java.io.BufferedInputStream javax.mail.util.SharedFileInputStream
public class SharedFileInputStream
Field Summary | |
---|---|
protected long |
bufpos
The file offset that is the first byte in the read buffer. |
protected int |
bufsize
The normal size of the read buffer. |
protected long |
datalen
The size of the file subset represented by this stream instance. |
protected RandomAccessFile |
in
The source of the file data. |
protected long |
start
The starting position of data represented by this stream relative to the start of the file data. |
Fields inherited from class java.io.BufferedInputStream |
---|
buf, count, marklimit, markpos, pos |
Constructor Summary | |
---|---|
SharedFileInputStream(File file)
Construct a SharedFileInputStream from a File object, using the default buffer size. |
|
SharedFileInputStream(File file,
int bufferSize)
Construct a SharedFileInputStream from a File object, with a given initial buffer size. |
|
SharedFileInputStream(String file)
Construct a SharedFileInputStream from a file name, using the default buffer size. |
|
SharedFileInputStream(String file,
int bufferSize)
Construct a SharedFileInputStream from a file name, with a given initial buffer size. |
Method Summary | |
---|---|
int |
available()
Return the number of bytes available for reading without blocking for a long period. |
void |
close()
Close the stream. |
long |
getPosition()
Return the current read position of the stream. |
void |
mark(int readlimit)
Mark the current position for retracing. |
boolean |
markSupported()
Indicates the mark() operation is supported. |
InputStream |
newStream(long offset,
long end)
Create a new stream from this stream, using the given start offset and length. |
int |
read()
Read a single byte of data from the input stream. |
int |
read(byte[] buffer,
int offset,
int length)
Read multiple bytes of data and place them directly into a byte-array buffer. |
void |
reset()
Reset the mark position. |
long |
skip(long n)
Skip the read pointer ahead a given number of bytes. |
Methods inherited from class java.io.FilterInputStream |
---|
read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected long bufpos
protected int bufsize
protected long datalen
protected RandomAccessFile in
protected long start
Constructor Detail |
---|
public SharedFileInputStream(String file) throws IOException
file
- The name of the file.
IOException
public SharedFileInputStream(File file) throws IOException
file
- The name of the file.
IOException
public SharedFileInputStream(String file, int bufferSize) throws IOException
file
- The name of the file.bufferSize
- The initial buffer size.
IOException
public SharedFileInputStream(File file, int bufferSize) throws IOException
file
- The name of the file.bufferSize
- The initial buffer size.
IOException
Method Detail |
---|
public int available() throws IOException
available
in class BufferedInputStream
IOException
public long getPosition()
getPosition
in interface SharedInputStream
public void mark(int readlimit)
mark
in class BufferedInputStream
readlimit
- The limit for the distance the read position can move from
the mark position before the mark is reset.public int read() throws IOException
read
in class BufferedInputStream
IOException
public int read(byte[] buffer, int offset, int length) throws IOException
read
in class BufferedInputStream
buffer
- The target buffer.offset
- The offset within the buffer to place the data.length
- The length to attempt to read.
IOException
public long skip(long n) throws IOException
skip
in class BufferedInputStream
n
- The number of bytes to skip.
IOException
public void reset() throws IOException
reset
in class BufferedInputStream
IOException
public boolean markSupported()
markSupported
in class BufferedInputStream
public void close() throws IOException
close
in interface Closeable
close
in class BufferedInputStream
IOException
public InputStream newStream(long offset, long end)
newStream
in interface SharedInputStream
offset
- The offset relative to the start of this stream instance.end
- The end offset of the substream. If -1, the end of the parent stream is used.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |