Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.mail.providers.mbox
Class MboxOutputStream  view MboxOutputStream download MboxOutputStream.java

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended bygnu.mail.providers.mbox.MboxOutputStream

class MboxOutputStream
extends java.io.FilterOutputStream

A filter stream that can escape mbox From_ lines in message content. This will only work reliably for messages with <4096 bytes in any one line.


Field Summary
protected  byte[] buf
          The buffer where the current line is stored.
protected  int count
          The number of valid bytes in the buffer.
private static byte KET
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
MboxOutputStream(java.io.OutputStream out)
          Constructs an mbox From_-escaping output stream with a buffer size of 1024 bytes.
MboxOutputStream(java.io.OutputStream out, int len)
          Constructs an mbox From_-escaping output stream with the specified buffer size.
 
Method Summary
 void flush()
          Flushes this output stream.
protected  void validateAndFlushBuffer()
          Flush the internal buffer.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KET

private static byte KET

buf

protected byte[] buf
The buffer where the current line is stored.


count

protected int count
The number of valid bytes in the buffer.

Constructor Detail

MboxOutputStream

public MboxOutputStream(java.io.OutputStream out)
Constructs an mbox From_-escaping output stream with a buffer size of 1024 bytes.


MboxOutputStream

public MboxOutputStream(java.io.OutputStream out,
                        int len)
Constructs an mbox From_-escaping output stream with the specified buffer size.

Method Detail

validateAndFlushBuffer

protected void validateAndFlushBuffer()
                               throws java.io.IOException
Flush the internal buffer.


write

public void write(int b)
           throws java.io.IOException
Writes the specified byte to this output stream.


write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.


flush

public void flush()
           throws java.io.IOException
Flushes this output stream.