Class Base64
- java.lang.Object
-
- org.apache.manifoldcf.core.common.Base64
-
public class Base64 extends java.lang.ObjectClass to manage straight and stream conversions to and from base64 encoding.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected byte[]byteBufferThis is a byte buffer which is needed during the encoding process.protected char[]characterBufferThis is a character buffer which is needed during the decoding process.
-
Constructor Summary
Constructors Constructor Description Base64()Construct the encoder/decoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandecodeNextWord(java.io.Reader inputBuffer, java.io.OutputStream outputBuffer)Decode the next base64 character.voiddecodeStream(java.io.Reader inputBuffer, java.io.OutputStream outputBuffer)Decode an entire stream.byte[]decodeString(java.lang.String inputString)Decode a string into a byte array.java.lang.StringencodeByteArray(byte[] inputByteArray)Encode a byte array to a string.booleanencodeNextWord(java.io.InputStream inputStream, java.io.Writer outputWriter)Encode a single word.voidencodeStream(java.io.InputStream inputStream, java.io.Writer outputWriter)Encode a full stream, to the end.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
characterBuffer
protected char[] characterBuffer
This is a character buffer which is needed during the decoding process.
-
byteBuffer
protected byte[] byteBuffer
This is a byte buffer which is needed during the encoding process.
-
-
Method Detail
-
decodeNextWord
public boolean decodeNextWord(java.io.Reader inputBuffer, java.io.OutputStream outputBuffer) throws ManifoldCFExceptionDecode the next base64 character. Reads a single encoded word from the input stream, and writes the decoded word to the output.- Parameters:
inputBuffer- is the character input stream.outputBuffer- is the binary output stream.- Returns:
- false if end-of-stream encountered, true otherwise
- Throws:
ManifoldCFException
-
decodeStream
public void decodeStream(java.io.Reader inputBuffer, java.io.OutputStream outputBuffer) throws ManifoldCFExceptionDecode an entire stream.- Parameters:
inputBuffer- is the character input stream.outputBuffer- is the binary output stream.- Throws:
ManifoldCFException
-
decodeString
public byte[] decodeString(java.lang.String inputString) throws ManifoldCFExceptionDecode a string into a byte array.- Parameters:
inputString- is the string.- Returns:
- a corresponding byte array.
- Throws:
ManifoldCFException
-
encodeNextWord
public boolean encodeNextWord(java.io.InputStream inputStream, java.io.Writer outputWriter) throws ManifoldCFExceptionEncode a single word.- Parameters:
inputStream- is the input binary data.outputWriter- is the character output stream.- Returns:
- false if end-of-stream encountered, true otherwise.
- Throws:
ManifoldCFException
-
encodeStream
public void encodeStream(java.io.InputStream inputStream, java.io.Writer outputWriter) throws ManifoldCFExceptionEncode a full stream, to the end.- Parameters:
inputStream- is the input stream.outputWriter- is the output writer.- Throws:
ManifoldCFException
-
encodeByteArray
public java.lang.String encodeByteArray(byte[] inputByteArray) throws ManifoldCFExceptionEncode a byte array to a string.- Parameters:
inputByteArray- is the byte array.- Returns:
- the encoded string.
- Throws:
ManifoldCFException
-
-