Package cds.savot.model.interpreter
Class UnicodeCharInterpreter
- java.lang.Object
-
- cds.savot.model.interpreter.BinaryFieldInterpreter<java.lang.Character>
-
- cds.savot.model.interpreter.CharInterpreter
-
- cds.savot.model.interpreter.UnicodeCharInterpreter
-
public class UnicodeCharInterpreter extends CharInterpreter
Binary interpreter for the type "unicodeChar" of VOTable.
- Null value = \0
- Size = 2 bytes
- 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
Constructors Constructor Description UnicodeCharInterpreter(int[] arraysizes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Character
decodePrimary(byte[] b, int offset)
Decodes only one data of type T from the given bytes array.byte[]
encodePrimary(java.lang.Character value)
Encodes a single value of type T in binary.-
Methods inherited from class cds.savot.model.interpreter.CharInterpreter
convertPrimary, getArrayClass
-
Methods inherited from class cds.savot.model.interpreter.BinaryFieldInterpreter
arraySizeToString, convertIntoArray, convertToString, createEmptyArray, createInterpreter, decode, encode, getArraySize, getPadding, getPadding, readBytes
-
-
-
-
Constructor Detail
-
UnicodeCharInterpreter
public UnicodeCharInterpreter(int[] arraysizes) throws BinaryInterpreterException
- Throws:
BinaryInterpreterException
-
-
Method Detail
-
decodePrimary
public java.lang.Character decodePrimary(byte[] b, int offset) throws BinaryInterpreterException
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.- Overrides:
decodePrimary
in classCharInterpreter
- 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.
-
encodePrimary
public byte[] encodePrimary(java.lang.Character value) throws BinaryInterpreterException
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.- Overrides:
encodePrimary
in classCharInterpreter
- 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.
-
-