org.mbari.hobilabs
Class HRBinaryDecoder
java.lang.Object
org.mbari.hobilabs.HRBinaryDecoder
- public class HRBinaryDecoder
- extends java.lang.Object
A decoder that reads information from binary Hydrorad files. They're are two
ways to use this class.
1) If you think all the data in the file is from the same instrument then use
this form (It's faster). This form does not read all serial numbers in a
binary file. This is the default method.
HRBinaryDecoder d = new HRBinaryDecoder( ..., false);
d.decode();
HRPacket[] data = d.getData();
String desc = d.getDataDescription();
String type = d.getInstrumentType();
String[] sn = d.getSerialNumbers(); // sn will be a String[1] array
2) If you need the serial numbers from each message.
HRBinaryDecoder d = new HRBinaryDecoder( ..., true);
d.decode();
HRPacket[] data = d.getData();
String desc = d.getDataDescription();
String type = d.getInstrumentType();
String[] sn = d.getSerialNumbers(); // sn will be a String[data.length] array
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HRBinaryDecoder
public HRBinaryDecoder(java.io.File infile)
- Parameters:
infile - File object representing the file to decode
HRBinaryDecoder
public HRBinaryDecoder(java.lang.String infile)
- Parameters:
infile - Name of the file to decode
HRBinaryDecoder
public HRBinaryDecoder(java.lang.String infile,
boolean getAllSerialNumbers)
- Parameters:
infile - Name of the fiel to decodegetAllSerialNumbers - true indicates that all serial numbers in the
file need to read. false indicates that only the very first one in the
file will be returned
HRBinaryDecoder
public HRBinaryDecoder(java.io.File infile,
boolean getAllSerialNumbers)
- Parameters:
infile - File object of the file to decodegetAllSerialNumbers - true indicates that all serial numbers in the
file need to read. false indicates that only the very first one in the
file will be returned.
decode
public void decode()
throws java.io.IOException
- Method to process the binary file. THis must be called before using the
accessor methods.
- Throws:
java.io.IOException
getData
public HRPacket[] getData()
- Returns:
- HRPacket[] an array of HRPackets. Each HRPacket contains a single
data record. Each HRPacket corresponds to a serial number returned by
getSerialNumbers if the getAllSerialNumbers is set to true.
setData
public void setData(HRPacket[] data)
- Parameters:
data - this method is required by HRNetcdfConstructor
getSerialNumbers
public java.lang.String[] getSerialNumbers()
- Returns:
- String[] an array of serial Numbers. Each serial number corresponds
to an HRPacket (serialNumber[3] is for HRPacket[3]).
getInstrumentType
public java.lang.String getInstrumentType()
- Returns:
- String Name of the instrument type. Will be "HR2" or "HR4".
getDataDescription
public java.lang.String getDataDescription()
- Returns a string of the channel description. All data packets are assumed
to contain the same description so only a single descrtiption is returned
for a file.
getChannelNumber
public int getChannelNumber()
getDataType
public java.lang.String getDataType()
getUnits
public java.lang.String getUnits()