Package org.apache.kerby.xdr.type
Class XdrSimple<T>
java.lang.Object
org.apache.kerby.xdr.type.AbstractXdrType<T>
org.apache.kerby.xdr.type.XdrSimple<T>
- All Implemented Interfaces:
XdrType
- Direct Known Subclasses:
XdrBoolean,XdrBytes,XdrEnumerated,XdrInteger,XdrLong,XdrString,XdrUnsignedInteger
Xdr simple type, of single value other than complex type of multiple values.
Including: Bytes, Integer, Boolean, String.
Use toBytes() for encoding, toValue() for decoding.
-
Constructor Summary
ConstructorsConstructorDescriptionXdrSimple(XdrDataType dataTypeNo) Default constructor, generally for decoding as a value containerXdrSimple(XdrDataType xdrDataType, T value) Constructor with a value, generally for encoding of the value -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(ByteBuffer content) Decode the content bytes into this type.protected voiddecodeBody(ByteBuffer body) protected byte[]protected voidencodeBody(ByteBuffer buffer) Put encoded bytes into buffer.protected intLength including null bytes to maintain an multiple of 4.protected byte[]getBytes()static booleanisSimple(XdrDataType dataType) protected voidsetBytes(byte[] bytes) protected abstract voidtoBytes()Encode simple type to bytes.protected abstract voidtoValue()Decode bytes to simple value.Methods inherited from class org.apache.kerby.xdr.type.AbstractXdrType
decode, encode, encode, encodingLength, getDataType, getValue, setValue
-
Constructor Details
-
XdrSimple
Default constructor, generally for decoding as a value container- Parameters:
dataTypeNo- The dataType number
-
XdrSimple
Constructor with a value, generally for encoding of the value- Parameters:
xdrDataType- The dataType numbervalue- The value
-
-
Method Details
-
getBytes
protected byte[] getBytes() -
setBytes
protected void setBytes(byte[] bytes) -
encodeBody
- Throws:
IOException
-
encodeBody
Put encoded bytes into buffer.- Specified by:
encodeBodyin classAbstractXdrType<T>- Parameters:
buffer- ByteBuffer to hold encoded bytes.- Throws:
IOException
-
encodingBodyLength
Length including null bytes to maintain an multiple of 4.- Specified by:
encodingBodyLengthin classAbstractXdrType<T>- Returns:
- The encoding body length
- Throws:
IOException
-
decode
Description copied from interface:XdrTypeDecode the content bytes into this type.- Specified by:
decodein interfaceXdrType- Overrides:
decodein classAbstractXdrType<T>- Parameters:
content- The content bytes- Throws:
IOException- e
-
decodeBody
- Throws:
IOException
-
toValue
Decode bytes to simple value.- Throws:
IOException
-
toBytes
Encode simple type to bytes.- Throws:
IOException- e
-
isSimple
-