Top Description Fields Constructors Methods
com.sun.mail.util

public Class QPEncoderStream

extends FilterOutputStream
Class Inheritance
Known Direct Subclasses
com.sun.mail.util.QEncoderStream
Imports
java.io.*

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.
Author
John Mani

Field Summary

Modifier and TypeField and Description
private int
private int
private boolean
private boolean
private static final char[]
Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
QPEncoderStream(OutputStream
the output stream
out
,
int
the number of bytes per line. The encoder inserts a CRLF sequence after this many number of bytes.
bytesPerLine
)

Create a QP encoder that encodes the specified input stream

public
QPEncoderStream(OutputStream
the output stream
out
)

Create a QP encoder that encodes the specified input stream.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Forces any buffered output bytes to be encoded out to the stream and closes this output stream.
public void
flush()

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

Flushes this output stream and forces any buffered output bytes to be encoded out to the stream.
protected void
output(int c, boolean encode)

private void
public void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.FilterOutputStream.write.

Encodes len bytes from the specified byte array starting at offset off to this output stream.
public void
write(byte[]
the data to be written.
b
)

Overrides java.io.FilterOutputStream.write.

Encodes b.length bytes to this output stream.
public void
write(int
the byte.
c
)

Overrides java.io.FilterOutputStream.write.

Encodes the specified byte to this output stream.

Field Detail

bytesPerLineback to summary
private int bytesPerLine
countback to summary
private int count
gotCRback to summary
private boolean gotCR
gotSpaceback to summary
private boolean gotSpace
hexback to summary
private static final char[] hex

Constructor Detail

QPEncoderStreamback to summary
public QPEncoderStream(OutputStream out, int bytesPerLine)

Create a QP encoder that encodes the specified input stream

Parameters
out:OutputStream

the output stream

bytesPerLine:int

the number of bytes per line. The encoder inserts a CRLF sequence after this many number of bytes.

QPEncoderStreamback to summary
public QPEncoderStream(OutputStream out)

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

Parameters
out:OutputStream

the output stream

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

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

Annotations
@Override
Exceptions
IOException:
for I/O errors
flushback to summary
public void flush() throws IOException

Overrides java.io.FilterOutputStream.flush.

Implements java.io.Flushable.flush.

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

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
outputback to summary
protected void output(int c, boolean encode) throws IOException
outputCRLFback to summary
private void outputCRLF() throws IOException
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterOutputStream.write.

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

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(byte[] b) throws IOException

Overrides java.io.FilterOutputStream.write.

Encodes b.length bytes to this output stream.

Parameters
b:byte[]

the data to be written.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(int c) throws IOException

Overrides java.io.FilterOutputStream.write.

Encodes the specified byte to this output stream.

Parameters
c:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.