Package cds.savot.model.interpreter
Class CharInterpreter
java.lang.Object
cds.savot.model.interpreter.BinaryFieldInterpreter<Character>
cds.savot.model.interpreter.CharInterpreter
- Direct Known Subclasses:
BitInterpreter,UnicodeCharInterpreter
Binary interpreter for the type "character" of VOTable.
- Null value = \0
- Size = 1 byte
- Java type = Character
- 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
ConstructorsConstructorDescriptionCharInterpreter(int[] arraysizes) CharInterpreter(int[] arraysizes, String typeLabel, int nbBytes) -
Method Summary
Modifier and TypeMethodDescriptionprotected CharacterconvertPrimary(Object value) Converts/Casts the given object into an object of type T.decodePrimary(byte[] b, int offset) Decodes only one data of type T from the given bytes array.byte[]encodePrimary(Character 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, convertIntoArray, convertToString, createEmptyArray, createInterpreter, decode, encode, getArraySize, getPadding, getPadding, readBytes
-
Constructor Details
-
CharInterpreter
- Throws:
BinaryInterpreterException
-
CharInterpreter
public CharInterpreter(int[] arraysizes, String typeLabel, int nbBytes) throws BinaryInterpreterException - Throws:
BinaryInterpreterException
-
-
Method Details
-
decodePrimary
Description copied from class:BinaryFieldInterpreterDecodes only one data of type T from the given bytes array.
WARNING:
bytesis supposed to contain enough bytes (>=BinaryFieldInterpreter.NB_BYTES) from the given offset.- Specified by:
decodePrimaryin classBinaryFieldInterpreter<Character>- Parameters:
b- 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:BinaryFieldInterpreterGets the precise array type.
Generally:
T[].class, where T must be a concrete class.- Specified by:
getArrayClassin classBinaryFieldInterpreter<Character>- Returns:
- The class of an array of type T.
-
convertPrimary
Description copied from class:BinaryFieldInterpreterConverts/Casts the given object into an object of type T.- Specified by:
convertPrimaryin classBinaryFieldInterpreter<Character>- 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:BinaryFieldInterpreterEncodes a single value of type T in binary.
NOTE: If the given value is null,
BinaryFieldInterpreter.getPadding()will be returned.- Specified by:
encodePrimaryin classBinaryFieldInterpreter<Character>- 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.
-