Package org.apache.james.mime4j.codec
Class Base64InputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.james.mime4j.codec.Base64InputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class Base64InputStream extends java.io.InputStreamPerforms Base-64 decoding on an underlying stream.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>>_recyclerRefprivate static int[]BASE64_DECODEprivate static byteBASE64_PADprivate booleanclosedprivate RecycledByteArrayBufferdecodedBufprivate byte[]encodedprivate static intENCODED_BUFFER_SIZEprivate booleaneofprivate static intEOFprivate java.io.InputStreaminprivate DecodeMonitormonitorprivate intpositionprivate byte[]singleByteprivate intsize
-
Constructor Summary
Constructors Modifier Constructor Description protectedBase64InputStream(int bufsize, java.io.InputStream in, DecodeMonitor monitor)Base64InputStream(java.io.InputStream in)Base64InputStream(java.io.InputStream in, boolean strict)Base64InputStream(java.io.InputStream in, DecodeMonitor monitor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()private intdecodePad(int data, int sextets, byte[] buffer, int index, int end)static BufferRecyclergetBufferRecycler()private voidhandleUnexpecedPad(int sextets)private voidhandleUnexpectedEof(int sextets)intread()intread(byte[] buffer)intread(byte[] buffer, int offset, int length)private intread0(byte[] buffer, int off, int len)
-
-
-
Field Detail
-
_recyclerRef
protected static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> _recyclerRef
-
ENCODED_BUFFER_SIZE
private static final int ENCODED_BUFFER_SIZE
- See Also:
- Constant Field Values
-
BASE64_DECODE
private static final int[] BASE64_DECODE
-
BASE64_PAD
private static final byte BASE64_PAD
- See Also:
- Constant Field Values
-
EOF
private static final int EOF
- See Also:
- Constant Field Values
-
singleByte
private final byte[] singleByte
-
in
private final java.io.InputStream in
-
encoded
private final byte[] encoded
-
decodedBuf
private final RecycledByteArrayBuffer decodedBuf
-
position
private int position
-
size
private int size
-
closed
private boolean closed
-
eof
private boolean eof
-
monitor
private final DecodeMonitor monitor
-
-
Constructor Detail
-
Base64InputStream
public Base64InputStream(java.io.InputStream in, DecodeMonitor monitor)
-
Base64InputStream
protected Base64InputStream(int bufsize, java.io.InputStream in, DecodeMonitor monitor)
-
Base64InputStream
public Base64InputStream(java.io.InputStream in)
-
Base64InputStream
public Base64InputStream(java.io.InputStream in, boolean strict)
-
-
Method Detail
-
getBufferRecycler
public static BufferRecycler getBufferRecycler()
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buffer) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buffer, int offset, int length) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
read0
private int read0(byte[] buffer, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
decodePad
private int decodePad(int data, int sextets, byte[] buffer, int index, int end) throws java.io.IOException- Throws:
java.io.IOException
-
handleUnexpectedEof
private void handleUnexpectedEof(int sextets) throws java.io.IOException- Throws:
java.io.IOException
-
handleUnexpecedPad
private void handleUnexpecedPad(int sextets) throws java.io.IOException- Throws:
java.io.IOException
-
-