SK.gnome.dwarf.mail.mime
Class StreamSource

java.lang.Object
  extended bySK.gnome.dwarf.mail.mime.StreamSource
All Implemented Interfaces:
SharedInputStreamSource

public class StreamSource
extends java.lang.Object
implements SharedInputStreamSource

Provides memory-based shared input stream source.


Constructor Summary
StreamSource(java.io.InputStream in)
          Creates a new StreamSource from the given stream.
 
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

StreamSource

public StreamSource(java.io.InputStream in)
             throws java.io.IOException
Creates a new StreamSource from the given stream.

This constructor preloads the entire source stream content into a byte buffer. All subsequent input streams are created from this buffer only.

Parameters:
in - the source stream
Throws:
java.io.IOException - if an error occurs
Method Detail

newStream

public java.io.InputStream newStream(int offset,
                                     int length)
                              throws java.io.IOException
Description copied from interface: SharedInputStreamSource
Creates a new stream from the underlying source stream.

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.

Specified by:
newStream in interface SharedInputStreamSource
Parameters:
offset - the offset
length - the length
Returns:
the new input stream
Throws:
java.io.IOException - if an error occurs

getSize

public int getSize()
Description copied from interface: SharedInputStreamSource
Returns the size of the base stream.

Specified by:
getSize in interface SharedInputStreamSource
Returns:
the size of the base stream


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.