Apache JAMES Mime4j 0.6-redhat-2

org.apache.james.mime4j.io
Class MimeBoundaryInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.apache.james.mime4j.io.LineReaderInputStream
              extended by org.apache.james.mime4j.io.MimeBoundaryInputStream
All Implemented Interfaces:
Closeable

public class MimeBoundaryInputStream
extends LineReaderInputStream

Stream that constrains itself to a single MIME body part. After the stream ends (i.e. read() returns -1) isLastPart() can be used to determine if a final boundary has been seen or not.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
MimeBoundaryInputStream(BufferedLineReaderInputStream inbuffer, String boundary)
          Creates a new MimeBoundaryInputStream.
 
Method Summary
 void close()
          Closes the underlying stream.
 boolean eof()
           
 boolean isLastPart()
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 int readLine(ByteArrayBuffer dst)
          Reads one line of text into the given ByteArrayBuffer.
 String toString()
           
 
Methods inherited from class java.io.FilterInputStream
available, mark, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MimeBoundaryInputStream

public MimeBoundaryInputStream(BufferedLineReaderInputStream inbuffer,
                               String boundary)
                        throws IOException
Creates a new MimeBoundaryInputStream.

Parameters:
inbuffer - The underlying stream.
boundary - Boundary string (not including leading hyphens).
Throws:
IllegalArgumentException - when boundary is too long
IOException
Method Detail

close

public void close()
           throws IOException
Closes the underlying stream.

Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException - on I/O errors.

markSupported

public boolean markSupported()
Overrides:
markSupported in class FilterInputStream
See Also:
InputStream.markSupported()

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException
See Also:
InputStream.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

readLine

public int readLine(ByteArrayBuffer dst)
             throws IOException
Description copied from class: LineReaderInputStream
Reads one line of text into the given ByteArrayBuffer.

Specified by:
readLine in class LineReaderInputStream
Parameters:
dst - Destination
Returns:
number of bytes copied or -1 if the end of the stream has been reached.
Throws:
IOException - in case of an I/O error.

isLastPart

public boolean isLastPart()

eof

public boolean eof()

toString

public String toString()
Overrides:
toString in class Object

Apache JAMES Mime4j 0.6-redhat-2

Copyright © 2004-2012 JBoss by Red Hat. All Rights Reserved.