|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
com.jkristian.io.Base64DecodeOutputStream
public class Base64DecodeOutputStream
A filter that decodes output from base64 encoding to binary bytes. Unexpected bytes are silently ignored.
Base64 encoding is defined by RFC 2045 (MIME) section 6.8.
Field Summary | |
---|---|
protected boolean |
flushCausesReset
whether flush() resets the decoder |
protected static byte[] |
map
|
protected byte |
n
index of the next expected input sextet |
protected static byte |
NUL
|
protected static byte |
PAD
|
protected byte |
x
the previous input sextet |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
Base64DecodeOutputStream(java.io.OutputStream out)
|
Method Summary | |
---|---|
void |
flush()
|
static void |
main(java.lang.String[] args)
A unit test. |
void |
setFlushCausesReset(boolean b)
Subsequently, a call to flush() will reset this object's state
if and only if the given parameter is true . |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class java.io.FilterOutputStream |
---|
close, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected byte n
protected byte x
protected boolean flushCausesReset
protected static final byte PAD
protected static final byte NUL
protected static final byte[] map
Constructor Detail |
---|
public Base64DecodeOutputStream(java.io.OutputStream out)
out
- should be buffered (e.g. a BufferedOutputStream) for
best performance. This class will write to it one byte at a time.Method Detail |
---|
public void write(int b) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.FilterOutputStream
java.io.IOException
public void setFlushCausesReset(boolean b)
flush()
will reset this object's state
if and only if the given parameter is true
.
The default setting (if this method is not called) is false
.
For example, write("BA"); flush(); write("BA")
will ordinarily
produce the same sequence of decoded bytes as write("BABA")
;
that is {4, 0, 64}.
But {4, 4} will be produced if setFlushCausesReset(true)
is called before flush()
. In the latter case,
the second "BA" will be decoded as if it appeared at the beginning of a stream.
b
- whether the decoder will be reset by a subsequent call to flush().
false
(the default) is appropriate if flush() is called
merely for performance optimization, and should not affect decoding.
true
is appropriate if a call to flush() indicates
a significant boundary in the data stream, such that previous
bytes should not be combined with subsequent bytes for decoding.public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |