A SharedFileInputStream is a
BufferedInputStream that buffers
data from the file and supports the mark
and reset methods. It also supports the
newStream method that allows you to create
other streams that represent subsets of the file.
A RandomAccessFile object is used to
access the file data.

Note that when the SharedFileInputStream is closed,
all streams created with the newStream
method are also closed. This allows the creator of the
SharedFileInputStream object to control access to the
underlying file and ensure that it is closed when
needed, to avoid leaking file descriptors. Note also
that this behavior contradicts the requirements of
SharedInputStream and may change in a future release.

Since:

JavaMail 1.4

Author:

Bill Shannon

Field Summary

protected long

bufpos
The file offset that corresponds to the first byte in
the read buffer.

newStream

public java.io.InputStream newStream(long start,
long end)

Return a new InputStream representing a subset of the data
from this InputStream, starting at start (inclusive)
up to end (exclusive). start must be
non-negative. If end is -1, the new stream ends
at the same place as this stream. The returned InputStream
will also implement the SharedInputStream interface.