abstract class Base64DecoderBase
extends java.lang.Object
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 |
---|---|
(package private) Stax2Util.ByteAggregator |
_byteAggr |
(package private) int |
_decodedData
Data decoded and/or ready to be output.
|
(package private) int |
_state
State of the state machine
|
(package private) Base64Variant |
_variant
Details of base64 variant (alphabet in use, padding, line length)
are contained in and accessed via this object.
|
(package private) static int |
INT_SPACE |
(package private) static int |
STATE_INITIAL
Initial state is where we start, and where white space
is accepted.
|
(package private) static 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)
|
(package private) static 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).
|
(package private) static int |
STATE_OUTPUT_3
State in which we have succesfully decoded a full triplet, but not
yet output any characters
|
(package private) static int |
STATE_VALID_1
State in which we have gotten one valid non-padding base64 encoded
character
|
(package private) static int |
STATE_VALID_2
State in which we have gotten two valid non-padding base64 encoded
characters.
|
(package private) static 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.
|
(package private) static int |
STATE_VALID_3
State in which we have gotten three valid non-padding base64 encoded
characters.
|
Modifier | Constructor and Description |
---|---|
protected |
Base64DecoderBase() |
Modifier and Type | Method and Description |
---|---|
abstract int |
decode(byte[] resultBuffer,
int resultOffset,
int maxLength)
Method that does actual decoding
|
byte[] |
decodeCompletely()
Method that can be called to completely decode content that this
decoder has been initialized with.
|
int |
endOfContent()
Method called to indicate that we have no more encoded content to
process, and decoding is to finish.
|
Stax2Util.ByteAggregator |
getByteAggregator() |
boolean |
hasData()
Method that can be called to check if this decoder is in has unflushed
data ready to be returned.
|
protected java.lang.IllegalArgumentException |
reportInvalidChar(char ch,
int bindex) |
protected java.lang.IllegalArgumentException |
reportInvalidChar(char ch,
int bindex,
java.lang.String msg) |
static final int STATE_INITIAL
static final int STATE_VALID_1
static final int STATE_VALID_2
static final int STATE_VALID_3
static final int STATE_OUTPUT_3
static final int STATE_OUTPUT_2
static final int STATE_OUTPUT_1
static final int STATE_VALID_2_AND_PADDING
static final int INT_SPACE
Base64Variant _variant
int _state
int _decodedData
Stax2Util.ByteAggregator _byteAggr
public abstract int decode(byte[] resultBuffer, int resultOffset, int maxLength) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public final boolean hasData()
public final int endOfContent()
public byte[] decodeCompletely()
public Stax2Util.ByteAggregator getByteAggregator()
protected java.lang.IllegalArgumentException reportInvalidChar(char ch, int bindex) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
protected java.lang.IllegalArgumentException reportInvalidChar(char ch, int bindex, java.lang.String msg) throws java.lang.IllegalArgumentException
bindex
- Relative index within base64 character unit; between 0
and 3 (as unit has exactly 4 characters)java.lang.IllegalArgumentException