Package com.fauna.codec.codecs
Class ByteArrayCodec
- java.lang.Object
-
- com.fauna.codec.codecs.BaseCodec<byte[]>
-
- com.fauna.codec.codecs.ByteArrayCodec
-
-
Field Summary
Fields Modifier and Type Field Description static ByteArrayCodec
SINGLETON
-
Constructor Summary
Constructors Constructor Description ByteArrayCodec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
decode(UTF8FaunaParser parser)
Decodes a byte array from the parser.void
encode(UTF8FaunaGenerator gen, byte[] obj)
Encodes a byte array to the generator.java.lang.Class<?>
getCodecClass()
Returns the class type this codec supports.FaunaType[]
getSupportedTypes()
Returns the Fauna types this codec supports.-
Methods inherited from class com.fauna.codec.codecs.BaseCodec
unexpectedTokenExceptionMessage, unexpectedTypeWhileDecoding, unsupportedTypeDecodingMessage, unsupportedTypeMessage
-
-
-
-
Field Detail
-
SINGLETON
public static final ByteArrayCodec SINGLETON
-
-
Method Detail
-
decode
public byte[] decode(UTF8FaunaParser parser) throws CodecException
Decodes a byte array from the parser.- Parameters:
parser
- the parser to read from- Returns:
- the decoded byte array, or null if the token represents a null value
- Throws:
CodecException
- if decoding fails due to an unexpected type
-
encode
public void encode(UTF8FaunaGenerator gen, byte[] obj) throws CodecException
Encodes a byte array to the generator.- Parameters:
gen
- the generator to write toobj
- the byte array to encode- Throws:
CodecException
- if encoding fails
-
getCodecClass
public java.lang.Class<?> getCodecClass()
Returns the class type this codec supports.- Returns:
- byte array class
-
getSupportedTypes
public FaunaType[] getSupportedTypes()
Returns the Fauna types this codec supports.- Returns:
- supported Fauna types
-
-