public interface Decoder
extends java.lang.AutoCloseable
Modifier and Type | Method and Description |
---|---|
default void |
close()
Finalize the current structure.
|
java.io.IOException |
createDeserializationException(java.lang.String message,
java.lang.Object invalidValue)
Creates an exception for the given message.
|
java.lang.Object |
decodeArbitrary()
Decodes the current state into an arbitrary object.
|
default Decoder |
decodeArray()
Start decoding an array.
|
Decoder |
decodeArray(io.micronaut.core.type.Argument<?> type)
Start decoding an array.
|
java.math.BigDecimal |
decodeBigDecimal()
Decodes a BigDecimal.
|
java.math.BigInteger |
decodeBigInteger()
Decodes a BigInteger.
|
boolean |
decodeBoolean()
Decodes a boolean.
|
Decoder |
decodeBuffer()
Buffer the whole subtree of this value and return it as a new
Decoder . |
byte |
decodeByte()
Decodes a byte.
|
char |
decodeChar()
Decodes a char.
|
double |
decodeDouble()
Decodes a double.
|
float |
decodeFloat()
Decodes a float.
|
int |
decodeInt()
Decodes a int.
|
java.lang.String |
decodeKey()
Decodes a key, if there are no more keys to decode returns
null . |
long |
decodeLong()
Decodes a long.
|
boolean |
decodeNull()
Attempt to decode a null value.
|
default Decoder |
decodeObject()
Decodes an object.
|
Decoder |
decodeObject(io.micronaut.core.type.Argument<?> type)
Decodes an object.
|
short |
decodeShort()
Decodes a short.
|
java.lang.String |
decodeString()
Decodes a string.
|
void |
finishStructure() |
boolean |
hasNextArrayValue() |
void |
skipValue()
Skips the current value.
|
@NonNull Decoder decodeArray(io.micronaut.core.type.Argument<?> type) throws java.io.IOException
type
- The array typejava.io.IOException
- If an unrecoverable error occurs@NonNull default Decoder decodeArray() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursboolean hasNextArrayValue() throws java.io.IOException
true
if another array value is available.java.io.IOException
- If an unrecoverable error occurs@NonNull Decoder decodeObject(@NonNull io.micronaut.core.type.Argument<?> type) throws java.io.IOException
type
- The type, never null
java.io.IOException
- If an unrecoverable error occurs@NonNull default Decoder decodeObject() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occurs@Nullable java.lang.String decodeKey() throws java.io.IOException
null
.null
if there aren't any more keysjava.io.IOException
- If an unrecoverable error occurs@NonNull java.lang.String decodeString() throws java.io.IOException
null
java.io.IOException
- If an unrecoverable error occursboolean decodeBoolean() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursbyte decodeByte() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursshort decodeShort() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occurschar decodeChar() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursint decodeInt() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occurslong decodeLong() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursfloat decodeFloat() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursdouble decodeDouble() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occurs@NonNull java.math.BigInteger decodeBigInteger() throws java.io.IOException
null
java.io.IOException
- If an unrecoverable error occurs@NonNull java.math.BigDecimal decodeBigDecimal() throws java.io.IOException
null
java.io.IOException
- If an unrecoverable error occursboolean decodeNull() throws java.io.IOException
false
if this value is not null, and another method should be
used for decoding. Returns true
if this value was null, and the cursor has been advanced to the next
value.true
if the value was null
java.io.IOException
- If an unrecoverable error occurs@Nullable java.lang.Object decodeArbitrary() throws java.io.IOException
The following should be decoded by this method:
Map
List
java.io.IOException
- If an unrecoverable error occursDecoder decodeBuffer() throws java.io.IOException
Decoder
. The returned Decoder
can
be used independently to this Decoder
. This means actual parsing of the subtree can be delayed.
The returned Decoder
should behave identically to this Decoder
. This means that for example
decoder.decodeDouble()
should be equivalent to decoder.decodeBuffer().decodeDouble()
.
java.io.IOException
- If an unrecoverable error occursvoid skipValue() throws java.io.IOException
java.io.IOException
- If an unrecoverable error occursvoid finishStructure() throws java.io.IOException
java.lang.IllegalStateException
- If there are still elements left to consumejava.io.IOException
- If an unrecoverable error occursdefault void close() throws java.io.IOException
finishStructure()
.close
in interface java.lang.AutoCloseable
java.io.IOException
- If an unrecoverable error occurs@NonNull java.io.IOException createDeserializationException(@NonNull java.lang.String message, @Nullable java.lang.Object invalidValue)
message
- The message, never null
invalidValue
- The invalid value. Can be null
.null