Package edu.sc.seis.seisFile.mseed
Class DataRecord
- java.lang.Object
-
- edu.sc.seis.seisFile.mseed.SeedRecord
-
- edu.sc.seis.seisFile.mseed.DataRecord
-
- All Implemented Interfaces:
java.io.Serializable
public class DataRecord extends SeedRecord implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
data
-
Fields inherited from class edu.sc.seis.seisFile.mseed.SeedRecord
blocketteFactory, blockettes, header, RECORD_SIZE
-
-
Constructor Summary
Constructors Constructor Description DataRecord(DataHeader header)
DataRecord(DataRecord record)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBlockette(Blockette b)
Adds a blockette to the record.edu.iris.dmc.seedcodec.DecompressedData
decompress()
Decompress the data in this record according to the compression type in the header.BtimeRange
getBtimeRange()
byte[]
getData()
returns the data from this data header unparsed, as a byte array in the format from blockette 1000.int
getDataSize()
java.lang.String
getEndTime()
get the value of end time.DataHeader
getHeader()
Btime
getLastSampleBtime()
return a Btime structure containing the derived last sample time for this record.java.lang.String
getLastSampleTime()
get the value of end time.Btime
getPredictedNextStartBtime()
returns the predicted start time of the next record, ie begin + numSample*period Note that this will use the more accurate sample rate in a blockette100 if it exists.float
getSampleRate()
Btime
getStartBtime()
Gets start Btime from header, convenience method.java.lang.String
getStartTime()
Gets start time from header, convenience method.void
printData(java.io.PrintWriter out)
static SeedRecord
readDataRecord(java.io.DataInput inStream, DataHeader header, int defaultRecordSize)
protected void
recheckDataOffset()
void
setData(byte[] data)
void
setRecordSize(int recordSize)
byte[]
toByteArray()
java.lang.String
toString()
void
write(java.io.DataOutputStream dos)
void
writeData(java.io.PrintWriter out)
Deprecated.Confusing method name, use printData(PrintWriter) for textual output and write(DataOutputStream) for binary output.-
Methods inherited from class edu.sc.seis.seisFile.mseed.SeedRecord
getBlocketteFactory, getBlockettes, getBlockettes, getControlHeader, getFirstPartialBlockette, getLastPartialBlockette, getNumBlockettes, getRecordSize, getUniqueBlockette, read, read, read, setBlocketteFactory, writeASCII, writeASCII
-
-
-
-
Constructor Detail
-
DataRecord
public DataRecord(DataHeader header)
-
DataRecord
public DataRecord(DataRecord record)
-
-
Method Detail
-
addBlockette
public void addBlockette(Blockette b) throws SeedFormatException
Adds a blockette to the record. The number of blockettes in the header is incremented automatically.- Overrides:
addBlockette
in classSeedRecord
- Throws:
SeedFormatException
-
recheckDataOffset
protected void recheckDataOffset() throws SeedFormatException
- Throws:
SeedFormatException
-
getData
public byte[] getData()
returns the data from this data header unparsed, as a byte array in the format from blockette 1000. The return type is byte[], so the caller must decode the data based on its format.
-
decompress
public edu.iris.dmc.seedcodec.DecompressedData decompress() throws SeedFormatException, edu.iris.dmc.seedcodec.UnsupportedCompressionType, edu.iris.dmc.seedcodec.CodecException
Decompress the data in this record according to the compression type in the header.- Returns:
- Throws:
SeedFormatException
- if no blockette 1000 presentedu.iris.dmc.seedcodec.UnsupportedCompressionType
edu.iris.dmc.seedcodec.CodecException
-
setData
public void setData(byte[] data) throws SeedFormatException
- Throws:
SeedFormatException
-
getDataSize
public int getDataSize()
-
getSampleRate
public float getSampleRate()
-
getPredictedNextStartBtime
public Btime getPredictedNextStartBtime()
returns the predicted start time of the next record, ie begin + numSample*period Note that this will use the more accurate sample rate in a blockette100 if it exists.
-
getBtimeRange
public BtimeRange getBtimeRange()
-
getLastSampleBtime
public Btime getLastSampleBtime()
return a Btime structure containing the derived last sample time for this record. Note that this will use the more accurate sample rate in a blockette100 if it exists.
-
getStartBtime
public Btime getStartBtime()
Gets start Btime from header, convenience method.
-
getStartTime
public java.lang.String getStartTime()
Gets start time from header, convenience method.
-
getEndTime
public java.lang.String getEndTime()
get the value of end time. derived from Start time, sample rate, and number of samples. Note this is not the time of the last sample, but rather the predicted begin time of the next record. Note that this will use the more accurate sample rate in a blockette100 if it exists.- Returns:
- the value of end time
-
getLastSampleTime
public java.lang.String getLastSampleTime()
get the value of end time. derived from Start time, sample rate, and number of samples. Note that this will use the more accurate sample rate in a blockette100 if it exists.- Returns:
- the value of end time
-
getHeader
public DataHeader getHeader()
-
toByteArray
public byte[] toByteArray()
-
write
public void write(java.io.DataOutputStream dos) throws java.io.IOException
- Throws:
java.io.IOException
-
writeData
@Deprecated public void writeData(java.io.PrintWriter out)
Deprecated.Confusing method name, use printData(PrintWriter) for textual output and write(DataOutputStream) for binary output.- Parameters:
out
-
-
printData
public void printData(java.io.PrintWriter out)
-
readDataRecord
public static SeedRecord readDataRecord(java.io.DataInput inStream, DataHeader header, int defaultRecordSize) throws java.io.IOException, SeedFormatException
- Throws:
java.io.IOException
SeedFormatException
-
setRecordSize
public void setRecordSize(int recordSize) throws SeedFormatException
- Throws:
SeedFormatException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classSeedRecord
-
-