|
IAIK CMS/SMIME Toolkit API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.BufferedInputStream
iaik.smime.SharedFileInputStream
public class SharedFileInputStream
A SharedFileInputStream for reading data from a file.
This class implements the JavaMail SharedInputStream
interface for creating substreams by calls to method newStream that read data from the same underlying file.
When creating a SharedFileInputStream
the file from which to read has to be specified:
File file = ...; SharedFileInputStream sfi = new SharedFileInputStream(file);This class uses a special
RandomAccessFileInputStream
to read the data from a basic file that is accessed through a
RandomAccessFile. Anytime when method newStream is called, a new substream is created to read data
from the same underlying file.
SharedInputStream| Field Summary |
|---|
| Fields inherited from class java.io.BufferedInputStream |
|---|
buf, count, marklimit, markpos, pos |
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
SharedFileInputStream(java.io.File file)
Creates a SharedFileInputStream for reading from the given file. |
|
SharedFileInputStream(java.io.File file,
int bufSize)
Creates a SharedFileInputStream for reading from the given file. |
|
| Method Summary | |
|---|---|
int |
available()
Gets the number of bytes that can be read from this stream without blocking. |
void |
close()
Closes this input stream. |
protected void |
finalize()
Performs finalization. |
long |
getPosition()
Gets the current position of the stream as offset from the start position. |
void |
mark(int readlimit)
Marks the current position in this input stream to start reading from it when method reset
is called. |
boolean |
markSupported()
Asks whether this input stream does support mark
and reset. |
java.io.InputStream |
newStream(long start,
long end)
Gets a new SharedInputStream as sub-stream from this InputStream. |
int |
read()
Reads one byte from this stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes from this stream. |
void |
reset()
Resets the stream to the position that has been previously set by calling method mark. |
long |
skip(long n)
Skips up to n bytes of data. |
| Methods inherited from class java.io.FilterInputStream |
|---|
read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SharedFileInputStream(java.io.File file)
throws java.io.IOException
file - the file from which to read
java.io.IOException - if an I/O error occurs
public SharedFileInputStream(java.io.File file,
int bufSize)
throws java.io.IOException
file - the file from which to readbufSize - the size of the internal buffer to be used
java.io.IOException - if an I/O error occurs| Method Detail |
|---|
public int read()
throws java.io.IOException
read in class java.io.BufferedInputStreamjava.io.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes from this stream.
read in class java.io.BufferedInputStreamb - the byte array into which to read the dataoff - the start offset in blen - the maximum number of bytes to read.
-1
if the end of the stream has been reached
java.io.IOException - if an I/O error occurs while reading from
the stream
public long skip(long n)
throws java.io.IOException
n bytes of data.
skip in class java.io.BufferedInputStreamn - the number of bytes to skip
java.io.IOException - error occurs while skipping
public int available()
throws java.io.IOException
available in class java.io.BufferedInputStreamjava.io.IOException - if an I/O error occurs.public void mark(int readlimit)
reset
is called.
mark in class java.io.BufferedInputStreamreadlimit - the number of bytes that can be read before
mark becomes invalidpublic void reset()
mark.
reset in class java.io.BufferedInputStreampublic boolean markSupported()
mark
and reset.
markSupported in class java.io.BufferedInputStreamtrue since this stream supports mark/reset
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.BufferedInputStreamjava.io.IOException - if an I/O error occurs when closing the stream.public long getPosition()
getPosition in interface javax.mail.internet.SharedInputStream
public java.io.InputStream newStream(long start,
long end)
newStream in interface javax.mail.internet.SharedInputStreamstart - the start position in the current streamend - the end position (+1) in the current stream;
-1 if the new stream shall end at the same position
as this stream
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable - if an error occurs during finalization
|
IAIK CMS/SMIME Toolkit API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
|
v6.1 (c) 2002 IAIK, (c) 2003 - 2025 SIC |
|