Class DoubleComplexInterpreter
Binary interpreter for the type "doubleComplex" of VOTable.
- Null value = NaN NaN
- Size = 2*8 bytes
- Java type = Double[2]
- Since:
- 09/2011
- Author:
- Gregory Mantelet
-
Field Summary
Fields inherited from class cds.savot.model.interpreter.BinaryFieldInterpreter
arraySeparator, arraySizeInterpreter, fixArraySizes, NB_BYTES, nbItems, strNullValue, TYPE_LABEL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertIntoArray
(Object value) Converts the given value (single value or multidimensional array) into one array of one dimension.protected Double[]
convertPrimary
(Object value) Converts/Casts the given object into an object of type T.Double[]
decodePrimary
(byte[] bytes, int offset) Decodes only one data of type T from the given bytes array.byte[]
encodePrimary
(Double[] value) Encodes a single value of type T in binary.Gets the precise array type.Methods inherited from class cds.savot.model.interpreter.BinaryFieldInterpreter
arraySizeToString, convertToString, createEmptyArray, createInterpreter, decode, encode, getArraySize, getPadding, getPadding, readBytes
-
Constructor Details
-
DoubleComplexInterpreter
- Throws:
BinaryInterpreterException
-
-
Method Details
-
decodePrimary
Description copied from class:BinaryFieldInterpreter
Decodes only one data of type T from the given bytes array.
WARNING:
bytes
is supposed to contain enough bytes (>=BinaryFieldInterpreter.NB_BYTES
) from the given offset.- Specified by:
decodePrimary
in classBinaryFieldInterpreter<Double[]>
- Parameters:
bytes
- Array to use to extract enough bytes so that decoding one data of type T.offset
- Position from which bytes must be read.- Returns:
- The decoded value.
- Throws:
BinaryInterpreterException
- If an error occurs while decoding bytes.
-
getArrayClass
Description copied from class:BinaryFieldInterpreter
Gets the precise array type.
Generally:
T[].class
, where T must be a concrete class.- Specified by:
getArrayClass
in classBinaryFieldInterpreter<Double[]>
- Returns:
- The class of an array of type T.
-
convertIntoArray
Description copied from class:BinaryFieldInterpreter
Converts the given value (single value or multidimensional array) into one array of one dimension.
NOTE: A String value will be considered as an array whose items are separated by
BinaryFieldInterpreter.arraySeparator
. Another type (except an array) must be understandable byBinaryFieldInterpreter.convertPrimary(Object)
.- Overrides:
convertIntoArray
in classBinaryFieldInterpreter<Double[]>
- Parameters:
value
- Value to convert (single value or multidimensional array).- Returns:
- A list of all values included into the given object.
- Throws:
BinaryInterpreterException
- IfBinaryFieldInterpreter.convertPrimary(Object)
fails.- See Also:
-
convertPrimary
Description copied from class:BinaryFieldInterpreter
Converts/Casts the given object into an object of type T.- Specified by:
convertPrimary
in classBinaryFieldInterpreter<Double[]>
- Parameters:
value
- The value to cast. (MAY BE NULL)- Returns:
- The casted value.
- Throws:
BinaryInterpreterException
- If there is an error while converting the given value.
-
encodePrimary
Description copied from class:BinaryFieldInterpreter
Encodes a single value of type T in binary.
NOTE: If the given value is null,
BinaryFieldInterpreter.getPadding()
will be returned.- Specified by:
encodePrimary
in classBinaryFieldInterpreter<Double[]>
- Parameters:
value
- The value to encode. (MAY BE NULL).- Returns:
- The value encoded in binary.
- Throws:
BinaryInterpreterException
- If there is an error while encoding the given value.
-