Package org.rcsb.cif.binary.data
Class Int16Array
java.lang.Object
org.rcsb.cif.binary.data.Int16Array
- All Implemented Interfaces:
EncodedData<int[]>,IntArray,NumberArray<int[]>,SignedIntArray<Int16Array>
public class Int16Array extends Object implements SignedIntArray<Int16Array>
An array of (signed) integer numbers using 16 bit to store each value.
-
Constructor Summary
Constructors Constructor Description Int16Array(int[] data)Int16Array(int[] data, Deque<Encoding<?,?>> encoding)Int16Array(ByteArray array) -
Method Summary
Modifier and Type Method Description Int16Arraydecode(DeltaEncoding<Int16Array> encoding)ByteArrayencode()Encode this array of numbers directly as binary data (useful for single values that won't benefit from more elaborate encoding chains).Int16Arrayencode(DeltaEncoding<Int16Array> encoding)int[]getData()Access to the underlying array of information.Deque<Encoding<?,?>>getEncoding()All encodings registered for this piece of EncodedData.intgetNumberOfBytes()The number of bytes used in this representation to describe a single value (e.g.intgetType()Report the type of this number array.booleanhasNextDecodingStep()Convenience method to state whether the List returned byEncodedData.getEncoding()is not empty.intlength()The number of elements in the wrapped array.voidsetEncoding(Deque<Encoding<?,?>> encoding)Replace this encoding chain with a different one.byte[]toByteArray()Converts this number array to its binary representation.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.rcsb.cif.binary.data.EncodedData
decode, getEncoding, hasNextDecodingStep, setEncoding
-
Constructor Details
-
Int16Array
public Int16Array(int[] data) -
Int16Array
-
Int16Array
-
-
Method Details
-
getData
public int[] getData()Description copied from interface:EncodedDataAccess to the underlying array of information.- Specified by:
getDatain interfaceEncodedData<int[]>- Specified by:
getDatain interfaceIntArray- Returns:
- an int[], double[], byte[], or String[]
-
length
public int length()Description copied from interface:EncodedDataThe number of elements in the wrapped array.- Specified by:
lengthin interfaceEncodedData<int[]>- Specified by:
lengthin interfaceIntArray- Returns:
- results of array.length
-
toByteArray
public byte[] toByteArray()Description copied from interface:NumberArrayConverts this number array to its binary representation.- Specified by:
toByteArrayin interfaceNumberArray<int[]>- Returns:
- a byte[]
-
getNumberOfBytes
public int getNumberOfBytes()Description copied from interface:NumberArrayThe number of bytes used in this representation to describe a single value (e.g. 1 forInt8Arrayand up to 8 forFloat64Array).- Specified by:
getNumberOfBytesin interfaceNumberArray<int[]>- Returns:
- a number between 1 and 4
-
getType
public int getType()Description copied from interface:NumberArrayReport the type of this number array.- 1 for
Int8Array - 2 for
Int16Array - 3 for
Int32Array - 4 for
Uint8Array - 5 for
Uint16Array - 6 for
Uint32Array - 32 for
Float32Array - 33 for
Float64Array
- Specified by:
getTypein interfaceNumberArray<int[]>- Returns:
- 1, 2, 3, 4, 5, 6, 32, 33
- 1 for
-
toString
-
encode
- Specified by:
encodein interfaceSignedIntArray<Int16Array>
-
encode
Description copied from interface:NumberArrayEncode this array of numbers directly as binary data (useful for single values that won't benefit from more elaborate encoding chains).- Specified by:
encodein interfaceNumberArray<int[]>- Returns:
- a
ByteArraywith a single encoding step
-
decode
- Specified by:
decodein interfaceSignedIntArray<Int16Array>
-
getEncoding
Description copied from interface:EncodedDataAll encodings registered for this piece of EncodedData. May be empty. May contain only partial data: e.g. adding a ByteArrayEncoding to the list will request encoding by ByteArrayCodec, this method call will subsequently fill all fields of the requested Encoding to allow for decoding.- Specified by:
getEncodingin interfaceEncodedData<D>- Returns:
- all associated Encoding instances
-
setEncoding
Description copied from interface:EncodedDataReplace this encoding chain with a different one.- Specified by:
setEncodingin interfaceEncodedData<D>- Parameters:
encoding- the new encoding chain for this instance
-
hasNextDecodingStep
public boolean hasNextDecodingStep()Description copied from interface:EncodedDataConvenience method to state whether the List returned byEncodedData.getEncoding()is not empty.- Specified by:
hasNextDecodingStepin interfaceEncodedData<D>- Returns:
- true if encoding steps are registered and need to be resolved to access decoded data
-