|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.BinaryArrayImpl
public class BinaryArrayImpl
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.
Field Summary | |
---|---|
static java.lang.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 java.lang.String |
DOUBLE_PRECISION
Defines the valid String indicating the correct precision for encoded doubles. |
static java.lang.String |
FLOAT_PRECISION
Defines the valid String indicating the correct precision for encoded floats. |
protected java.lang.String |
iBase64String
Represents the binary contents of the array as an array of bytes. |
protected java.lang.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 java.lang.String |
iDataPrecision
Represents the precision of the binary array (mzData element .../data/precision). |
static java.lang.String |
LITTLE_ENDIAN_LABEL
Defines the valid String indicating little endian byte order. |
Constructor Summary | |
---|---|
protected |
BinaryArrayImpl()
Default constructor with protected access. |
|
BinaryArrayImpl(double[] doubleArray,
java.lang.String aDataEndian)
Constructor that allows the creation of a BinaryArray object using an array of double values. |
|
BinaryArrayImpl(float[] floatArray,
java.lang.String aDataEndian)
Constructor that allows the creation of a BinaryArray object using an array of float values. |
|
BinaryArrayImpl(java.lang.String aBase64String,
long aDataLength,
java.lang.String aDataEndian,
java.lang.String aDataPrecision)
Creates an instance of this BinaryArray object, setting all fields as per description below. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Performs equals methods dependent on values of instance variables and class of Object o. |
java.lang.String |
getBase64String()
|
java.lang.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). |
java.lang.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()
|
java.lang.String |
toString()
Returns a useful String representation of this Imlplementation instance that includes details of all fields. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String BIG_ENDIAN_LABEL
public static final java.lang.String LITTLE_ENDIAN_LABEL
public static final java.lang.String FLOAT_PRECISION
public static final java.lang.String DOUBLE_PRECISION
public static final int BYTES_TO_HOLD_FLOAT
public static final int BYTES_TO_HOLD_DOUBLE
protected java.lang.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 java.lang.String iDataEndian
Represents the endian value of the binary array (mzData element .../data/endian).
protected java.lang.String iDataPrecision
Represents the precision of the binary array (mzData element .../data/precision).
Constructor Detail |
---|
protected BinaryArrayImpl()
Default constructor with protected access.
public BinaryArrayImpl(java.lang.String aBase64String, long aDataLength, java.lang.String aDataEndian, java.lang.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, java.lang.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, java.lang.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").Method Detail |
---|
public java.lang.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 java.lang.String getDataEndian()
Returns the endian value of the binary array (mzData element .../data/endian).
public java.lang.String getDataPrecision()
Returns the precision of the binary array (mzData element .../data/precision).
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
Performs equals methods dependent on values of instance variables and class of Object o.
equals
in class java.lang.Object
o
- Object that this is being compared with.
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |