Class Overview
This class implements a BASE64 Character decoder as specified in RFC1521.
This RFC is part of the MIME specification which is published by the
Internet Engineering Task Force (IETF). Unlike some other encoding
schemes there is nothing in this encoding that tells the decoder
where a buffer starts or stops, so to use it you will need to isolate
your encoded data into a single chunk and then feed them this decoder.
The simplest way to do that is to read all of the encoded data into a
string and then use:
byte mydata[];
BASE64Decoder base64 = new BASE64Decoder();
mydata = base64.decodeBuffer(bufferString);
This will decode the String in
bufferString and give you an array
of bytes in the array
myData.
On errors, this class throws a CEFormatException with the following detail
strings:
"BASE64Decoder: Not enough bytes for an atom."
Summary
[Expand]
Inherited Methods |
From class
sun.misc.CharacterDecoder
abstract
int
|
bytesPerAtom()
Return the number of bytes per atom of decoding
|
abstract
int
|
bytesPerLine()
Return the maximum number of bytes that can be encoded per line
|
void
|
decodeAtom(PushbackInputStream aStream, OutputStream bStream, int l)
This method does an actual decode.
|
void
|
decodeBuffer(InputStream aStream, OutputStream bStream)
Decode the text from the InputStream and write the decoded
octets to the OutputStream.
|
byte[]
|
decodeBuffer(InputStream in)
Decode the contents of the inputstream into a buffer.
|
byte[]
|
decodeBuffer(String inputString)
Alternate decode interface that takes a String containing the encoded
buffer and returns a byte array containing the data.
|
void
|
decodeBufferPrefix(PushbackInputStream aStream, OutputStream bStream)
decode the beginning of the buffer, by default this is a NOP.
|
void
|
decodeBufferSuffix(PushbackInputStream aStream, OutputStream bStream)
decode the buffer suffix, again by default it is a NOP.
|
ByteBuffer
|
decodeBufferToByteBuffer(InputStream in)
Decode the contents of the inputStream into a ByteBuffer.
|
ByteBuffer
|
decodeBufferToByteBuffer(String inputString)
Decode the contents of the String into a ByteBuffer.
|
int
|
decodeLinePrefix(PushbackInputStream aStream, OutputStream bStream)
This method should return, if it knows, the number of bytes
that will be decoded.
|
void
|
decodeLineSuffix(PushbackInputStream aStream, OutputStream bStream)
This method post processes the line, if there are error detection
or correction codes in a line, they are generally processed by
this method.
|
int
|
readFully(InputStream in, byte[] buffer, int offset, int len)
This method works around the bizarre semantics of BufferedInputStream's
read method.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Public Constructors
Protected Methods
protected
int
bytesPerAtom
()
This class has 4 bytes per atom
protected
int
bytesPerLine
()
Any multiple of 4 will do, 72 might be common
Decode one BASE64 atom into 1, 2, or 3 bytes of data.