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

public Class QPDecoderStream

extends FilterInputStream
Class Inheritance
Known Direct Subclasses
com.sun.mail.util.QDecoderStream
Imports
java.io.*

This class implements a QP Decoder. It is implemented as a FilterInputStream, so one can just wrap this class around any input stream and read bytes from this filter. The decoding is done as the bytes are read out.
Author
John Mani

Field Summary

Modifier and TypeField and Description
protected byte[]
protected int
Inherited from java.io.FilterInputStream:
in

Constructor Summary

AccessConstructor and Description
public
QPDecoderStream(InputStream
the input stream
in
)

Create a Quoted Printable decoder that decodes the specified input stream.

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.FilterInputStream.available.

Returns the number of bytes that can be read from this input stream without blocking.
public boolean
markSupported()

Overrides java.io.FilterInputStream.markSupported.

Tests if this input stream supports marks.
public int

Returns:

the next byte of data, or -1 if the end of the stream is reached.
read
()

Overrides java.io.FilterInputStream.read.

Read the next decoded byte from this input stream.
public int

Returns:

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
read
(byte[]
the buffer into which the data is read.
buf
,
int
the start offset of the data.
off
,
int
the maximum number of bytes read.
len
)

Overrides java.io.FilterInputStream.read.

Reads up to len decoded bytes of data from this input stream into an array of bytes.
public long
skip(long
the number of bytes to be skipped.
n
)

Overrides java.io.FilterInputStream.skip.

Skips over and discards n bytes of data from this stream.
Inherited from java.io.FilterInputStream:
closemarkreadreset

Field Detail

baback to summary
protected byte[] ba
spacesback to summary
protected int spaces

Constructor Detail

QPDecoderStreamback to summary
public QPDecoderStream(InputStream in)

Create a Quoted Printable decoder that decodes the specified input stream.

Parameters
in:InputStream

the input stream

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.FilterInputStream.available.

Returns the number of bytes that can be read from this input stream without blocking. The QP algorithm does not permit a priori knowledge of the number of bytes after decoding, so this method just invokes the available method of the original input stream.

Returns:int

Doc from java.io.FilterInputStream.available.

an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.available.

if an I/O error occurs.

markSupportedback to summary
public boolean markSupported()

Overrides java.io.FilterInputStream.markSupported.

Tests if this input stream supports marks. Currently this class does not support marks

Returns:boolean

Doc from java.io.FilterInputStream.markSupported.

true if this stream type supports the mark and reset method; false otherwise.

Annotations
@Override
readback to summary
public int read() throws IOException

Overrides java.io.FilterInputStream.read.

Read the next decoded byte from this input stream. The byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public int read(byte[] buf, int off, int len) throws IOException

Overrides java.io.FilterInputStream.read.

Reads up to len decoded bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

Parameters
buf:byte[]

the buffer into which the data is read.

off:int

the start offset of the data.

len:int

the maximum number of bytes read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
skipback to summary
public long skip(long n) throws IOException

Overrides java.io.FilterInputStream.skip.

Skips over and discards n bytes of data from this stream.

Parameters
n:long

Doc from java.io.FilterInputStream.skip.

the number of bytes to be skipped.

Returns:long

Doc from java.io.FilterInputStream.skip.

the actual number of bytes skipped.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.skip.

if in.skip(n) throws an IOException.