|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.mail.mime.FileSource
Provides file-based shared input stream source.
Constructor Summary | |
FileSource(java.io.File file,
int preloadLimit)
Creates a new FileSource from the given file. |
|
FileSource(java.lang.String filename,
int preloadLimit)
Creates a new FileSource from the given file. |
Method Summary | |
int |
getSize()
Returns the size of the base stream. |
java.io.InputStream |
newStream(int offset,
int length)
Creates a new stream from the underlying source stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileSource(java.lang.String filename, int preloadLimit) throws java.io.IOException
This constructor creates a java.io.File object from the given filename
argument and passes it to the FileSource(File, int)
constructor.
filename
- the name of the source filepreloadLimit
- maximum message size limit for preloading byte content
java.io.IOException
- if an error occurspublic FileSource(java.io.File file, int preloadLimit) throws java.io.IOException
If the preloadLimit argument is greater than zero and the actual file
size is less or equal than it, the file content will be preloaded first into a byte buffer
and the subsequent streams returned from newStream(int, int)
method will be always
backed by the buffered data. Zero value means that the subsequent streams will be always
created from a new file input stream instances.
file
- the source filepreloadLimit
- maximum message size limit for preloading byte content
java.io.IOException
- if an error occursMethod Detail |
public java.io.InputStream newStream(int offset, int length) throws java.io.IOException, MimeException
SharedInputStreamSource
The new stream begins at the offset position of the original source stream and its total length is limited to length octets.
The returned input stream may be buffered for a better efficiency.
newStream
in interface SharedInputStreamSource
offset
- the offsetlength
- the length
java.io.IOException
- if an error occurs
MimeException
public int getSize()
SharedInputStreamSource
getSize
in interface SharedInputStreamSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |