Class TraceBuf2


  • public class TraceBuf2
    extends java.lang.Object
    • Constructor Detail

      • TraceBuf2

        protected TraceBuf2()
        for use by static read method.
      • TraceBuf2

        public TraceBuf2​(int pin,
                         int numSamples,
                         double startTime,
                         double sampleRate,
                         java.lang.String station,
                         java.lang.String network,
                         java.lang.String channel,
                         java.lang.String locId,
                         short[] data)
      • TraceBuf2

        public TraceBuf2​(int pin,
                         int numSamples,
                         double startTime,
                         double sampleRate,
                         java.lang.String station,
                         java.lang.String network,
                         java.lang.String channel,
                         java.lang.String locId,
                         int[] intData)
      • TraceBuf2

        public TraceBuf2​(int pin,
                         int numSamples,
                         double startTime,
                         double sampleRate,
                         java.lang.String station,
                         java.lang.String network,
                         java.lang.String channel,
                         java.lang.String locId,
                         float[] data)
      • TraceBuf2

        public TraceBuf2​(int pin,
                         int numSamples,
                         double startTime,
                         double sampleRate,
                         java.lang.String station,
                         java.lang.String network,
                         java.lang.String channel,
                         java.lang.String locId,
                         double[] data)
      • TraceBuf2

        public TraceBuf2​(byte[] data)
    • Method Detail

      • read

        public static TraceBuf2 read​(java.io.DataInput in)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • extractNumSamples

        public static int extractNumSamples​(byte[] data,
                                            boolean swapBytes)
      • extractDataType

        public static java.lang.String extractDataType​(byte[] data)
      • isSwapBytes

        public static boolean isSwapBytes​(java.lang.String dataType)
      • getSampleSize

        public static int getSampleSize​(java.lang.String dataType)
      • write

        public void write​(java.io.DataOutputStream out)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • split

        public java.util.List<TraceBuf2> split​(int maxSize)
      • isShortData

        public boolean isShortData()
      • isIntData

        public boolean isIntData()
      • isFloatData

        public boolean isFloatData()
      • isDoubleData

        public boolean isDoubleData()
      • isShortData

        public static boolean isShortData​(java.lang.String dataType)
      • isIntData

        public static boolean isIntData​(java.lang.String dataType)
      • isFloatData

        public static boolean isFloatData​(java.lang.String dataType)
      • isDoubleData

        public static boolean isDoubleData​(java.lang.String dataType)
      • getPin

        public int getPin()
      • getNumSamples

        public int getNumSamples()
      • getStartTime

        public double getStartTime()
      • getEndTime

        public double getEndTime()
      • getPredictedNextStartTime

        public double getPredictedNextStartTime()
        Predicted start of the next tracebuf in seconds.
      • getPredictedNextStartDate

        public java.util.Date getPredictedNextStartDate()
        Predicted start of the next tracebuf.
      • getStartDate

        public java.util.Date getStartDate()
      • getEndDate

        public java.util.Date getEndDate()
      • getSampleRate

        public double getSampleRate()
      • getStation

        public java.lang.String getStation()
      • getNetwork

        public java.lang.String getNetwork()
      • getChannel

        public java.lang.String getChannel()
      • formatNSLCCodes

        public java.lang.String formatNSLCCodes()
      • getLocId

        public java.lang.String getLocId()
      • getVersion

        public java.lang.String getVersion()
      • getDataType

        public java.lang.String getDataType()
      • getQuality

        public short getQuality()
      • getPad

        public short getPad()
      • getShortData

        public short[] getShortData()
      • getIntData

        public int[] getIntData()
      • getFloatData

        public float[] getFloatData()
      • getDoubleData

        public double[] getDoubleData()
      • getSeedEncoding

        public byte getSeedEncoding()
      • toByteArray

        public byte[] toByteArray()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • encodeSteim1

        public edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim1​(int recLenExp)
                                                            throws SeedFormatException
        encodes the data as Steim1. The encoding will stop when full, the caller must check the number of samples in the returned SteimFramBlock to ensure all samples were included.
        Parameters:
        recLenExp - power of 2 for record size, generally 8-12
        Returns:
        Steim1 encoding of the data
        Throws:
        SeedFormatException - if data is not integer or compression errors occur
      • encodeSteim1

        public edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim1​(int recLenExp,
                                                                   int offset)
                                                            throws SeedFormatException
        encodes the data starting at offset as Steim1. The encoding will stop when full, the caller must check the number of samples in the returned SteimFramBlock to ensure all samples were included.
        Parameters:
        recLenExp - power of 2 for record size, generally 8-12
        offset - starting point for encoding, first sample to use
        Returns:
        Steim1 encoding of the data
        Throws:
        SeedFormatException - if data is not integer or compression errors occur
      • encodeSteim2

        public edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim2​(int recLenExp)
                                                            throws SeedFormatException
        encodes the data as Steim2. The encoding will stop when full, the caller must check the number of samples in the returned SteimFramBlock to ensure all samples were included.
        Parameters:
        recLenExp - power of 2 for record size, generally 8-12
        Returns:
        Steim2 encoding of the data
        Throws:
        SeedFormatException - if data is not integer or compression errors occur
      • encodeSteim2

        public edu.iris.dmc.seedcodec.SteimFrameBlock encodeSteim2​(int recLenExp,
                                                                   int offset)
                                                            throws SeedFormatException
        encodes the data starting at offset as Steim1. The encoding will stop when full, the caller must check the number of samples in the returned SteimFramBlock to ensure all samples were included.
        Parameters:
        recLenExp - power of 2 for record size, generally 8-12
        offset - starting point for encoding, first sample to use
        Returns:
        Steim2 encoding of the data
        Throws:
        SeedFormatException - if data is not integer or compression errors occur
      • toMiniSeed

        @Deprecated
        public java.util.List<DataRecord> toMiniSeed​(int recLenExp,
                                                     boolean doSteim1)
                                              throws SeedFormatException
        Deprecated.
        use toMiniSeedNoCompression(int) or toMiniSeed(int, int) instead
        Coverts the data to Miniseed, spliting into multiple data records if it will not fit into one.
        Parameters:
        recLenExp - power of 2 for record size, generally 8-12
        doSteim1 - if Steim1 compression should be applied
        Returns:
        Miniseed records
        Throws:
        SeedFormatException
      • checkRecordLengthExp

        public static void checkRecordLengthExp​(int recLenExp)
      • getSize

        public int getSize()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toStringWithData

        public java.lang.String toStringWithData()