public class

QPEncoderStream

extends FilterOutputStream
java.lang.Object
   ↳ java.io.OutputStream
     ↳ java.io.FilterOutputStream
       ↳ com.google.code.com.sun.mail.util.QPEncoderStream
Known Direct Subclasses

Class Overview

This class implements a Quoted Printable Encoder. It is implemented as a FilterOutputStream, so one can just wrap this class around any output stream and write bytes into this filter. The Encoding is done as the bytes are written out.

Summary

Fields
private int bytesPerLine
private int count
private boolean gotCR
private boolean gotSpace
private static final char[] hex
[Expand]
Inherited Fields
From class java.io.FilterOutputStream
Public Constructors
QPEncoderStream(OutputStream out, int bytesPerLine)
Create a QP encoder that encodes the specified input stream
QPEncoderStream(OutputStream out)
Create a QP encoder that encodes the specified input stream.
Public Methods
void close()
Forces any buffered output bytes to be encoded out to the stream and closes this output stream
void flush()
Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.
void write(byte[] b, int off, int len)
Encodes len bytes from the specified byte array starting at offset off to this output stream.
void write(byte[] b)
Encodes b.length bytes to this output stream.
void write(int c)
Encodes the specified byte to this output stream.
Protected Methods
void output(int c, boolean encode)
[Expand]
Inherited Methods
From class java.io.FilterOutputStream
From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable

Fields

private int bytesPerLine

private int count

private boolean gotCR

private boolean gotSpace

private static final char[] hex

Public Constructors

public QPEncoderStream (OutputStream out, int bytesPerLine)

Create a QP encoder that encodes the specified input stream

Parameters
out The output stream
bytesPerLine The number of bytes per line. The encoder inserts a CRLF sequence after this many number of bytes.

public QPEncoderStream (OutputStream out)

Create a QP encoder that encodes the specified input stream. Inserts the CRLF sequence after outputting 76 bytes.

Parameters
out The output stream

Public Methods

public void close ()

Forces any buffered output bytes to be encoded out to the stream and closes this output stream

Throws
IOException

public void flush ()

Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.

Throws
IOException if an I/O error occurs.

public void write (byte[] b, int off, int len)

Encodes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b The data.
off The start offset in the data.
len The number of bytes to write.
Throws
IOException if an I/O error occurs.

public void write (byte[] b)

Encodes b.length bytes to this output stream.

Parameters
b The data to be written.
Throws
IOException if an I/O error occurs.

public void write (int c)

Encodes the specified byte to this output stream.

Parameters
c The byte.
Throws
IOException if an I/O error occurs.

Protected Methods

protected void output (int c, boolean encode)

Parameters
c
encode
Throws
IOException