Package org.apache.ws.commons.util
Class Base64.Decoder
- java.lang.Object
-
- org.apache.ws.commons.util.Base64.Decoder
-
- Enclosing class:
- Base64
public abstract static class Base64.Decoder extends java.lang.Object
An encoder is an object, which is able to decode char arrays in blocks of four bytes. Any such block is converted into a array of three bytes.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]
byteBuffer
private int
byteBufferOffset
private int
eofBytes
private int
num
private int
numBytes
-
Constructor Summary
Constructors Modifier Constructor Description protected
Decoder(int pBufLen)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
flush()
Indicates, that no more data is being expected.void
write(char[] pData, int pOffset, int pLen)
Converts the Base64 encoded character array.protected abstract void
writeBuffer(byte[] pBuffer, int pOffset, int pLen)
Called for writing the decoded bytes to the destination.
-
-
-
Constructor Detail
-
Decoder
protected Decoder(int pBufLen)
Creates a new instance.- Parameters:
pBufLen
- The decoders buffer size. The decoder will store up to this number of decoded bytes before invokingwriteBuffer(byte[],int,int)
.
-
-
Method Detail
-
writeBuffer
protected abstract void writeBuffer(byte[] pBuffer, int pOffset, int pLen) throws java.io.IOException
Called for writing the decoded bytes to the destination.- Parameters:
pBuffer
- The byte array being written.pOffset
- Offset of the first byte being written.pLen
- Number of bytes being written.- Throws:
java.io.IOException
- Writing to the destination failed.
-
write
public void write(char[] pData, int pOffset, int pLen) throws java.io.IOException
Converts the Base64 encoded character array.- Parameters:
pData
- The character array being decoded.pOffset
- Offset of first character being decoded.pLen
- Number of characters being decoded.- Throws:
Base64.DecodingException
- Decoding failed.java.io.IOException
- An invocation of thewriteBuffer(byte[],int,int)
method failed.
-
flush
public void flush() throws java.io.IOException
Indicates, that no more data is being expected. Writes all currently buffered data to the destination by invokingwriteBuffer(byte[],int,int)
.- Throws:
Base64.DecodingException
- Decoding failed (Unexpected end of file).java.io.IOException
- An invocation of thewriteBuffer(byte[],int,int)
method failed.
-
-