Package org.apache.kerby.xdr.type
Class AbstractXdrType<T>
java.lang.Object
org.apache.kerby.xdr.type.AbstractXdrType<T>
- Type Parameters:
T- the type of the value encoded/decoded or wrapped by this
- All Implemented Interfaces:
XdrType
- Direct Known Subclasses:
XdrSimple,XdrStructType,XdrUnion
The abstract XDR type for all the XDR types. It provides basic
encoding and decoding utilities.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractXdrType(XdrDataType dataType) Default constructor.AbstractXdrType(XdrDataType dataType, T value) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(byte[] content) Decode the content bytes into this type.voiddecode(ByteBuffer content) Decode the content bytes into this type.byte[]encode()Encode the type, by recursively.voidencode(ByteBuffer buffer) Encode the type, by recursively, using the provided buffer.protected abstract voidencodeBody(ByteBuffer buffer) protected abstract intintGet length of encoding bytes by just calculating without real encoding.getValue()void
-
Constructor Details
-
AbstractXdrType
Default constructor.- Parameters:
dataType- the dataTypevalue- the value
-
AbstractXdrType
Default constructor.- Parameters:
dataType- the dataType
-
-
Method Details
-
encode
Description copied from interface:XdrTypeEncode the type, by recursively.- Specified by:
encodein interfaceXdrType- Returns:
- encoded bytes
- Throws:
IOException- e
-
encode
Description copied from interface:XdrTypeEncode the type, by recursively, using the provided buffer.- Specified by:
encodein interfaceXdrType- Parameters:
buffer- The byte buffer- Throws:
IOException- e
-
encodeBody
- Throws:
IOException
-
decode
Description copied from interface:XdrTypeDecode the content bytes into this type.- Specified by:
decodein interfaceXdrType- Parameters:
content- The content bytes- Throws:
IOException- e
-
encodingLength
Description copied from interface:XdrTypeGet length of encoding bytes by just calculating without real encoding. Generally it's called to prepare for the encoding buffer.- Specified by:
encodingLengthin interfaceXdrType- Returns:
- length of encoding bytes
- Throws:
IOException- e
-
encodingBodyLength
- Throws:
IOException
-
decode
Description copied from interface:XdrTypeDecode the content bytes into this type.- Specified by:
decodein interfaceXdrType- Parameters:
content- The content bytes- Throws:
IOException- e
-
getValue
-
setValue
-
getDataType
-