| java.lang.Object | ||||
| ↳ | java.io.InputStream | |||
| ↳ | java.io.FilterInputStream | |||
| ↳ | java.io.BufferedInputStream | |||
| ↳ | com.google.code.javax.mail.util.SharedFileInputStream | |||
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.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.InputStream
| |||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| bufpos | The file offset that corresponds to the first byte in the read buffer. | ||||||||||
| bufsize | The normal size of the read buffer. | ||||||||||
| datalen | The amount of data in this subset of the file. | ||||||||||
| defaultBufferSize | |||||||||||
| in | The file containing the data. | ||||||||||
| master | True if this is a top level stream created directly by "new". | ||||||||||
| sf | |||||||||||
| start | The file offset of the start of data in this subset of the file. | ||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.BufferedInputStream
| |||||||||||
From class
java.io.FilterInputStream
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a
SharedFileInputStream
for the file. | |||||||||||
Creates a
SharedFileInputStream
for the named file | |||||||||||
Creates a
SharedFileInputStream
with the specified buffer size. | |||||||||||
Creates a
SharedFileInputStream
with the specified buffer size. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the number of bytes that can be read from this input
stream without blocking.
| |||||||||||
Closes this input stream and releases any system resources
associated with the stream.
| |||||||||||
Return the current position in the InputStream, as an
offset from the beginning of the InputStream.
| |||||||||||
See the general contract of the
mark
method of InputStream. | |||||||||||
Tests if this input stream supports the
mark
and reset methods. | |||||||||||
Return a new InputStream representing a subset of the data
from this InputStream, starting at
start (inclusive)
up to end (exclusive). | |||||||||||
See the general contract of the
read
method of InputStream. | |||||||||||
Reads bytes from this stream into the specified byte array,
starting at the given offset.
| |||||||||||
See the general contract of the
reset
method of InputStream. | |||||||||||
See the general contract of the
skip
method of InputStream. | |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Force this stream to close.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.BufferedInputStream
| |||||||||||
From class
java.io.FilterInputStream
| |||||||||||
From class
java.io.InputStream
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.google.code.javax.mail.internet.SharedInputStream
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
The file offset that corresponds to the first byte in the read buffer.
The normal size of the read buffer.
The amount of data in this subset of the file.
The file containing the data. Shared by all related SharedFileInputStreams.
True if this is a top level stream created directly by "new". False if this is a derived stream created by newStream.
The file offset of the start of data in this subset of the file.
Creates a SharedFileInputStream
for the file.
| file | The file |
|---|
| IOException |
|---|
Creates a SharedFileInputStream
for the named file
| file | The file |
|---|
| IOException |
|---|
Creates a SharedFileInputStream
with the specified buffer size.
| file | The file |
|---|---|
| size | The buffer size. |
| IllegalArgumentException | if size <= 0. |
|---|---|
| IOException |
Creates a SharedFileInputStream
with the specified buffer size.
| file | The file |
|---|---|
| size | The buffer size. |
| IllegalArgumentException | if size <= 0. |
|---|---|
| IOException |
Returns the number of bytes that can be read from this input stream without blocking.
| IOException | if an I/O error occurs. |
|---|
Closes this input stream and releases any system resources associated with the stream.
| IOException | if an I/O error occurs. |
|---|
Return the current position in the InputStream, as an offset from the beginning of the InputStream.
See the general contract of the mark
method of InputStream.
| readlimit | The maximum limit of bytes that can be read before the mark position becomes invalid. |
|---|
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.
| start | The starting position |
|---|---|
| end | The ending position + 1 |
See the general contract of the read
method of InputStream.
-1 if the end of the
stream is reached.| IOException | if an I/O error occurs. |
|---|
Reads bytes from this stream into the specified byte array, starting at the given offset.
This method implements the general contract of the corresponding
method of the readjava.io.InputStream class.
| b | Destination buffer. |
|---|---|
| off | Offset at which to start storing bytes. |
| len | Maximum number of bytes to read. |
-1 if the end of
the stream has been reached.| IOException | if an I/O error occurs. |
|---|
See the general contract of the reset
method of InputStream.
If markpos is -1
(no mark has been set or the mark has been
invalidated), an IOException
is thrown. Otherwise, pos is
set equal to markpos.
| IOException | if this stream has not been marked or if the mark has been invalidated. |
|---|
See the general contract of the skip
method of InputStream.
| n | The number of bytes to be skipped. |
|---|
| IOException | if an I/O error occurs. |
|---|
Force this stream to close.
| Throwable |
|---|