public class BinaryArrayImpl extends Object
Persistence independent object model implementation class:
Implements a binary array of the kind found in mzData/spectrumList/spectrum/mzArrayBinary or mzData/spectrumList/spectrum/intenArrayBinary. Holds both the data itself and meta data describing the encoding of the data.
Modifier and Type | Field and Description |
---|---|
static String |
BIG_ENDIAN_LABEL
Defines the valid String indicating big endian byte order.
|
static int |
BYTES_TO_HOLD_DOUBLE
Defines the number of bytes required in an UNENCODED byte array to hold a
dingle double value.
|
static int |
BYTES_TO_HOLD_FLOAT
Defines the number of bytes required in an UNENCODED byte array to hold a
single float value.
|
static String |
DOUBLE_PRECISION
Defines the valid String indicating the correct precision for encoded
doubles.
|
static String |
FLOAT_PRECISION
Defines the valid String indicating the correct precision for encoded
floats.
|
protected String |
iBase64String
Represents the binary contents of the array as an array of bytes.
|
protected String |
iDataEndian
Represents the endian value of the binary array (mzData element
.../data/endian).
|
protected long |
iDataLength
Represents the length of the binary array (mzData element
.../data/length).
|
protected String |
iDataPrecision
Represents the precision of the binary array (mzData element
.../data/precision).
|
static String |
LITTLE_ENDIAN_LABEL
Defines the valid String indicating little endian byte order.
|
Modifier | Constructor and Description |
---|---|
protected |
BinaryArrayImpl()
Default constructor with protected access.
|
|
BinaryArrayImpl(double[] doubleArray,
String aDataEndian)
Constructor that allows the creation of a BinaryArray object using an
array of double values.
|
|
BinaryArrayImpl(float[] floatArray,
String aDataEndian)
Constructor that allows the creation of a BinaryArray object using an
array of float values.
|
|
BinaryArrayImpl(String aBase64String,
long aDataLength,
String aDataEndian,
String aDataPrecision)
Creates an instance of this BinaryArray object, setting all fields as
per description below.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Performs equals methods dependent on values of instance variables and
class of Object o.
|
String |
getBase64String() |
String |
getDataEndian()
Returns the endian value of the binary array (mzData element
.../data/endian).
|
long |
getDataLength()
Returns the length of the binary array (mzData element
.../data/length).
|
String |
getDataPrecision()
Returns the precision of the binary array (mzData element
.../data/precision).
|
byte[] |
getDecodedByteArray()
Returns the contents of the binary array decoded using the
Base64 algorithm.
|
double[] |
getDoubleArray()
Checks if all the necessary information is provided and then converts the
decoded binary array into an array of double values (that for example
could be used to draw a spectra).
|
int |
hashCode() |
String |
toString()
Returns a useful String representation of this Imlplementation instance
that includes details of all fields.
|
public static final String BIG_ENDIAN_LABEL
public static final String LITTLE_ENDIAN_LABEL
public static final String FLOAT_PRECISION
public static final String DOUBLE_PRECISION
public static final int BYTES_TO_HOLD_FLOAT
public static final int BYTES_TO_HOLD_DOUBLE
protected String iBase64String
Represents the binary contents of the array as an array of bytes. (mzData element .../binaryDataGroup.)
Note that the contents of
this field can be obtained from a database by calling the
java.sql.Blob.getBytes():byte[]
method.
protected long iDataLength
Represents the length of the binary array (mzData element .../data/length).
protected String iDataEndian
Represents the endian value of the binary array (mzData element .../data/endian).
protected String iDataPrecision
Represents the precision of the binary array (mzData element .../data/precision).
protected BinaryArrayImpl()
Default constructor with protected access.
public BinaryArrayImpl(String aBase64String, long aDataLength, String aDataEndian, String aDataPrecision)
Creates an instance of this BinaryArray object, setting all fields as per description below.
aBase64String
- the binary contents of the array as an array of
bytes. (mzData element .../binaryDataGroup.) Note that the contents of
this field can be obtained from a database by calling the
java.sql.Blob.getBytes():byte[] method.aDataLength
- the length of the binary array (mzData element
.../data/length).aDataEndian
- The byte order is used when reading or writing
multibyte values stored as mzData element .../data/endian. Only possible
values are defined by the static String members of this class
'BIG_ENDIAN_LABEL' (or "big") and 'LITTLE_ENDIAN_LABEL' (or "little").aDataPrecision
- the precision of the binary array (mzData element
.../data/precision) that indicates if the array contains encoded double
values or encoded float values. Only possible values for this parameter
are defined byt he static String members of this class 'FLOAT_PRECISION'
(or "32") and 'DOUBLE_PRECISION' (or "64").public BinaryArrayImpl(double[] doubleArray, String aDataEndian)
doubleArray
- being the array of double values to be converted to
base64 and placed in the mzData element .../binaryDataGroup.aDataEndian
- The byte order is used when reading or writing
multibyte values stored as mzData element .../data/endian. Only possible
values are defined by the static String members of this class
'BIG_ENDIAN_LABEL' (or "big") and 'LITTLE_ENDIAN_LABEL' (or "little").public BinaryArrayImpl(float[] floatArray, String aDataEndian)
floatArray
- being the array of float values to be converted to
base64 and placed in the mzData element .../binaryDataGroup.aDataEndian
- The byte order is used when reading or writing
multibyte values stored as mzData element .../data/endian. Only possible
values are defined by the static String members of this class
'BIG_ENDIAN_LABEL' (or "big") and 'LITTLE_ENDIAN_LABEL' (or "little").public String getBase64String()
public byte[] getDecodedByteArray()
Returns the contents of the binary array decoded using the Base64 algorithm.
public double[] getDoubleArray()
public long getDataLength()
Returns the length of the binary array (mzData element .../data/length).
public String getDataEndian()
Returns the endian value of the binary array (mzData element .../data/endian).
public String getDataPrecision()
Returns the precision of the binary array (mzData element .../data/precision).
public String toString()
public boolean equals(Object o)
Performs equals methods dependent on values of instance variables and class of Object o.
Copyright © 2016. All rights reserved.