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

public Class Base32Encoder

extends Object
implements Encoder
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.encoders.Encoder
Imports
java.io.IOException, .OutputStream, org.bouncycastle.util.Arrays, .Strings

A streaming Base32 encoder.

Field Summary

Modifier and TypeField and Description
private static final byte[]
private final byte[]
private static final byte
private final byte[]
private final byte

Constructor Summary

AccessConstructor and Description
public
Base32Encoder()

Base constructor for RFC 4648, Section 6.

public
Base32Encoder(byte[]
a 32 entry encoding table to do the mapping.
encodingTable
,
byte
the padding value to use.
padding
)

Constructor allowing the setting of an alternative alphabet.

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 32 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 32 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, char c5, char c6, char c7, char c8)

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 32 output stream.

private void
encodeBlock(byte[] inBuf, int inPos, byte[] outBuf, int outPos)

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)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEAULT_ENCODING_TABLEback to summary
private static final byte[] DEAULT_ENCODING_TABLE
decodingTableback to summary
private final byte[] decodingTable
DEFAULT_PADDINGback to summary
private static final byte DEFAULT_PADDING
encodingTableback to summary
private final byte[] encodingTable
paddingback to summary
private final byte padding

Constructor Detail

Base32Encoderback to summary
public Base32Encoder()

Base constructor for RFC 4648, Section 6.

Base32Encoderback to summary
public Base32Encoder(byte[] encodingTable, byte padding)

Constructor allowing the setting of an alternative alphabet.

Parameters
encodingTable:byte[]

a 32 entry encoding table to do the mapping.

padding:byte

the padding value to use.

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 32 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 32 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, char c5, char c6, char c7, char c8) 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 32 output stream.

Returns:int

the number of bytes produced.

encodeBlockback to summary
private void encodeBlock(byte[] inBuf, int inPos, byte[] outBuf, int outPos)
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)