Package org.apache.james.mime4j.codec
Class QuotedPrintableInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.james.mime4j.codec.QuotedPrintableInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class QuotedPrintableInputStream extends java.io.InputStream
Performs Quoted-Printable decoding on an underlying stream.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>>
_recyclerRef
private RecycledByteArrayBuffer
blanks
private boolean
closed
private static byte
CR
private RecycledByteArrayBuffer
decodedBuf
private static int
DEFAULT_BUFFER_SIZE
private byte[]
encoded
private static byte
EQ
private java.io.InputStream
in
private boolean
lastWasCR
private static byte
LF
private int
limit
private DecodeMonitor
monitor
private int
pos
private byte[]
singleByte
-
Constructor Summary
Constructors Modifier Constructor Description protected
QuotedPrintableInputStream(int bufsize, java.io.InputStream in, boolean strict)
protected
QuotedPrintableInputStream(int bufsize, java.io.InputStream in, DecodeMonitor monitor)
QuotedPrintableInputStream(java.io.InputStream in)
QuotedPrintableInputStream(java.io.InputStream in, boolean strict)
QuotedPrintableInputStream(java.io.InputStream in, DecodeMonitor monitor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Terminates Quoted-Printable coded content.private int
convert(int c)
Converts '0' => 0, 'A' => 10, etc.private int
fillBuffer()
static BufferRecycler
getBufferRecycler()
private int
getnext()
private int
peek(int i)
int
read()
int
read(byte[] b, int off, int len)
private int
read0(byte[] buffer, int off, int len)
private int
transfer(int b, byte[] buffer, int from, int to, boolean keepblanks)
-
-
-
Field Detail
-
_recyclerRef
protected static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> _recyclerRef
-
DEFAULT_BUFFER_SIZE
private static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
EQ
private static final byte EQ
- See Also:
- Constant Field Values
-
CR
private static final byte CR
- See Also:
- Constant Field Values
-
LF
private static final byte LF
- See Also:
- Constant Field Values
-
singleByte
private final byte[] singleByte
-
in
private final java.io.InputStream in
-
decodedBuf
private final RecycledByteArrayBuffer decodedBuf
-
blanks
private final RecycledByteArrayBuffer blanks
-
encoded
private final byte[] encoded
-
pos
private int pos
-
limit
private int limit
-
lastWasCR
private boolean lastWasCR
-
closed
private boolean closed
-
monitor
private final DecodeMonitor monitor
-
-
Constructor Detail
-
QuotedPrintableInputStream
public QuotedPrintableInputStream(java.io.InputStream in, DecodeMonitor monitor)
-
QuotedPrintableInputStream
protected QuotedPrintableInputStream(int bufsize, java.io.InputStream in, DecodeMonitor monitor)
-
QuotedPrintableInputStream
protected QuotedPrintableInputStream(int bufsize, java.io.InputStream in, boolean strict)
-
QuotedPrintableInputStream
public QuotedPrintableInputStream(java.io.InputStream in, boolean strict)
-
QuotedPrintableInputStream
public QuotedPrintableInputStream(java.io.InputStream in)
-
-
Method Detail
-
getBufferRecycler
public static BufferRecycler getBufferRecycler()
-
close
public void close()
Terminates Quoted-Printable coded content. This method does NOT close the underlying input stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
-
fillBuffer
private int fillBuffer() throws java.io.IOException
- Throws:
java.io.IOException
-
getnext
private int getnext()
-
peek
private int peek(int i)
-
transfer
private int transfer(int b, byte[] buffer, int from, int to, boolean keepblanks) throws java.io.IOException
- Throws:
java.io.IOException
-
read0
private int read0(byte[] buffer, int off, int len) throws java.io.IOException
- Throws:
java.io.IOException
-
convert
private int convert(int c)
Converts '0' => 0, 'A' => 10, etc.- Parameters:
c
- ASCII character value.- Returns:
- Numeric value of hexadecimal character.
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-