Mostly what follows is just shared definitions of the state machine states to use, but there is also shared convenience functionality for convenience decoding into simple byte arrays.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Stax2Util. | |
| pack-priv int | _decodedData
Data decoded and/or ready to be output. |
| pack-priv int | _state
State of the state machine |
| pack-priv Base64Variant | _variant
Details of base64 variant (alphabet in use, padding, line length) are contained in and accessed via this object. |
| pack-priv static final int | |
| pack-priv static final int | STATE_INITIAL
Initial state is where we start, and where white space is accepted. |
| pack-priv static final int | STATE_OUTPUT_1
State in which we have 1 decoded byte to output (either due to partial triplet, or having output some of decoded bytes earlier) |
| pack-priv static final int | STATE_OUTPUT_2
State in which we have 2 decoded bytes to output (either due to partial triplet, or having output one byte from full triplet). |
| pack-priv static final int | STATE_OUTPUT_3
State in which we have succesfully decoded a full triplet, but not yet output any characters |
| pack-priv static final int | STATE_VALID_1
State in which we have gotten one valid non-padding base64 encoded character |
| pack-priv static final int | STATE_VALID_2
State in which we have gotten two valid non-padding base64 encoded characters. |
| pack-priv static final int | STATE_VALID_2_AND_PADDING
State in which we have gotten two valid non-padding base64 encoded characters, followed by a single padding character. |
| pack-priv static final int | STATE_VALID_3
State in which we have gotten three valid non-padding base64 encoded characters. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract int | |
| public byte[] | decodeCompletely()
Method that can be called to completely decode content that this decoder has been initialized with. |
| public final int | endOfContent()
Method called to indicate that we have no more encoded content to process, and decoding is to finish. |
| public Stax2Util. | |
| public final boolean | hasData()
Method that can be called to check if this decoder is in has unflushed data ready to be returned. |
| protected IllegalArgumentException | |
| protected IllegalArgumentException | reportInvalidChar(char ch, int
Relative index within base64 character unit; between 0
and 3 (as unit has exactly 4 characters) bindex, String msg)
|
| _byteAggr | back to summary |
|---|---|
| pack-priv Stax2Util. | |
| _decodedData | back to summary |
|---|---|
| pack-priv int _decodedData Data decoded and/or ready to be output. Alignment and storage format depend on state: during decoding things are appended from lowest significant bits, and during output, flushed from more significant bytes. | |
| _state | back to summary |
|---|---|
| pack-priv int _state State of the state machine | |
| _variant | back to summary |
|---|---|
| pack-priv Base64Variant _variant Details of base64 variant (alphabet in use, padding, line length) are contained in and accessed via this object. It is passed through init methods. | |
| INT_SPACE | back to summary |
|---|---|
| pack-priv static final int INT_SPACE | |
| STATE_INITIAL | back to summary |
|---|---|
| pack-priv static final int STATE_INITIAL Initial state is where we start, and where white space is accepted. | |
| STATE_OUTPUT_1 | back to summary |
|---|---|
| pack-priv static final int STATE_OUTPUT_1 State in which we have 1 decoded byte to output (either due to partial triplet, or having output some of decoded bytes earlier) | |
| STATE_OUTPUT_2 | back to summary |
|---|---|
| pack-priv static final int STATE_OUTPUT_2 State in which we have 2 decoded bytes to output (either due to partial triplet, or having output one byte from full triplet). | |
| STATE_OUTPUT_3 | back to summary |
|---|---|
| pack-priv static final int STATE_OUTPUT_3 State in which we have succesfully decoded a full triplet, but not yet output any characters | |
| STATE_VALID_1 | back to summary |
|---|---|
| pack-priv static final int STATE_VALID_1 State in which we have gotten one valid non-padding base64 encoded character | |
| STATE_VALID_2 | back to summary |
|---|---|
| pack-priv static final int STATE_VALID_2 State in which we have gotten two valid non-padding base64 encoded characters. | |
| STATE_VALID_2_AND_PADDING | back to summary |
|---|---|
| pack-priv static final int STATE_VALID_2_AND_PADDING State in which we have gotten two valid non-padding base64 encoded characters, followed by a single padding character. This means that we must get one more padding character to be able to decode the single encoded byte | |
| STATE_VALID_3 | back to summary |
|---|---|
| pack-priv static final int STATE_VALID_3 State in which we have gotten three valid non-padding base64 encoded characters. | |
| Base64DecoderBase | back to summary |
|---|---|
| protected Base64DecoderBase() | |
| decode | back to summary |
|---|---|
| public abstract int decode(byte[] resultBuffer, int resultOffset, int maxLength) throws IllegalArgumentException Method that does actual decoding | |
| decodeCompletely | back to summary |
|---|---|
| public byte[] decodeCompletely() Method that can be called to completely decode content that this decoder has been initialized with. | |
| endOfContent | back to summary |
|---|---|
| public final int endOfContent() Method called to indicate that we have no more encoded content to process, and decoding is to finish. Depending base64 variant in use, this means one of three things:
| |
| getByteAggregator | back to summary |
|---|---|
| public Stax2Util. | |
| hasData | back to summary |
|---|---|
| public final boolean hasData() Method that can be called to check if this decoder is in has unflushed data ready to be returned. | |
| reportInvalidChar | back to summary |
|---|---|
| protected IllegalArgumentException reportInvalidChar(char ch, int bindex) throws IllegalArgumentException | |
| reportInvalidChar | back to summary |
|---|---|
protected IllegalArgumentException reportInvalidChar(char ch, int bindex, String msg) throws IllegalArgumentException
| |