Top Description Fields Constructors Methods
org.bouncycastle.util.encoders

public Class Base64Encoder

extends Object
implements Encoder
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.encoders.Encoder
Known Direct Subclasses
org.bouncycastle.util.encoders.UrlBase64Encoder
Imports
java.io.IOException, .OutputStream

A streaming Base64 encoder.

Field Summary

Modifier and TypeField and Description
protected final byte[]
protected final byte[]
protected byte

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the number of bytes produced.
decode
(byte[] data, int off, int length, OutputStream out)

Implements org.bouncycastle.util.encoders.Encoder.decode.

decode the base 64 encoded byte data writing it to the given output stream, whitespace characters will be ignored.

public int

Returns:

the number of bytes produced.
decode
(String data, OutputStream out)

Implements org.bouncycastle.util.encoders.Encoder.decode.

decode the base 64 encoded String data writing it to the given output stream, whitespace characters will be ignored.

private int
decodeLastBlock(OutputStream out, char c1, char c2, char c3, char c4)

public int
encode(byte[] inBuf, int inOff, int inLen, byte[] outBuf, int outOff)

public int

Returns:

the number of bytes produced.
encode
(byte[] buf, int off, int len, OutputStream out)

Implements org.bouncycastle.util.encoders.Encoder.encode.

encode the input data producing a base 64 output stream.

public int
getEncodedLength(int
the input length of the data.
inputLength
)

Implements org.bouncycastle.util.encoders.Encoder.getEncodedLength.

Return the expected output length of the encoding.

public int
getMaxDecodedLength(int
the input length of the encoded data.
inputLength
)

Implements org.bouncycastle.util.encoders.Encoder.getMaxDecodedLength.

Return the maximum expected output length of a decoding.

private boolean
ignore(char c)

protected void
private int
nextI(byte[] data, int i, int finish)

private int
nextI(String data, int i, int finish)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decodingTableback to summary
protected final byte[] decodingTable
encodingTableback to summary
protected final byte[] encodingTable
paddingback to summary
protected byte padding

Constructor Detail

Base64Encoderback to summary
public Base64Encoder()

Method Detail

decodeback to summary
public int decode(byte[] data, int off, int length, OutputStream out) throws IOException

Implements org.bouncycastle.util.encoders.Encoder.decode.

decode the base 64 encoded byte data writing it to the given output stream, whitespace characters will be ignored.

Returns:int

the number of bytes produced.

decodeback to summary
public int decode(String data, OutputStream out) throws IOException

Implements org.bouncycastle.util.encoders.Encoder.decode.

decode the base 64 encoded String data writing it to the given output stream, whitespace characters will be ignored.

Returns:int

the number of bytes produced.

decodeLastBlockback to summary
private int decodeLastBlock(OutputStream out, char c1, char c2, char c3, char c4) throws IOException
encodeback to summary
public int encode(byte[] inBuf, int inOff, int inLen, byte[] outBuf, int outOff) throws IOException
encodeback to summary
public int encode(byte[] buf, int off, int len, OutputStream out) throws IOException

Implements org.bouncycastle.util.encoders.Encoder.encode.

encode the input data producing a base 64 output stream.

Returns:int

the number of bytes produced.

getEncodedLengthback to summary
public int getEncodedLength(int inputLength)

Implements org.bouncycastle.util.encoders.Encoder.getEncodedLength.

Doc from org.bouncycastle.util.encoders.Encoder.getEncodedLength.

Return the expected output length of the encoding.

Parameters
inputLength:int

the input length of the data.

Returns:int

the output length of an encoding.

getMaxDecodedLengthback to summary
public int getMaxDecodedLength(int inputLength)

Implements org.bouncycastle.util.encoders.Encoder.getMaxDecodedLength.

Doc from org.bouncycastle.util.encoders.Encoder.getMaxDecodedLength.

Return the maximum expected output length of a decoding. If padding is present the value returned will be greater than the decoded data length.

Parameters
inputLength:int

the input length of the encoded data.

Returns:int

the upper bound of the output length of a decoding.

ignoreback to summary
private boolean ignore(char c)
initialiseDecodingTableback to summary
protected void initialiseDecodingTable()
nextIback to summary
private int nextI(byte[] data, int i, int finish)
nextIback to summary
private int nextI(String data, int i, int finish)