Class Btime

java.lang.Object
edu.sc.seis.seisFile.mseed.Btime

public class Btime
extends java.lang.Object
  • Field Summary

    Fields 
    Modifier and Type Field Description
    int hour  
    int jday  
    int min  
    int sec  
    int tenthMilli  
    static java.util.TimeZone UTC  
    int year  
  • Constructor Summary

    Constructors 
    Constructor Description
    Btime()  
    Btime​(byte[] bytes)  
    Btime​(byte[] bytes, int offset)  
    Btime​(double d)
    Create with seconds since epoch (1970)
    Btime​(int year, int jday, int hour, int min, int sec, int tenthMilli)  
    Btime​(java.util.Date date)  
  • Method Summary

    Modifier and Type Method Description
    boolean after​(Btime other)  
    boolean afterOrEquals​(Btime other)  
    boolean before​(Btime other)  
    java.util.Calendar convertToCalendar()  
    boolean equals​(java.lang.Object o)  
    byte[] getAsBytes()  
    int getDayOfYear()  
    int getHour()  
    int getJDay()  
    int getMin()  
    int getSec()  
    int getTenthMilli()  
    int getYear()  
    int hashCode()  
    static boolean shouldSwapBytes​(byte[] btime)
    Expects btime to be a byte array pointing at the beginning of a btime segment
    static boolean shouldSwapBytes​(byte[] btime, int offset)
    Expects btime to be a byte array pointing at the beginning of a btime segment.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • UTC

      public static final java.util.TimeZone UTC
    • year

      public int year
    • jday

      public int jday
    • hour

      public int hour
    • min

      public int min
    • sec

      public int sec
    • tenthMilli

      public int tenthMilli
  • Constructor Details

    • Btime

      public Btime​(java.util.Date date)
    • Btime

      public Btime()
    • Btime

      public Btime​(int year, int jday, int hour, int min, int sec, int tenthMilli)
    • Btime

      public Btime​(byte[] bytes)
    • Btime

      public Btime​(byte[] bytes, int offset)
    • Btime

      public Btime​(double d)
      Create with seconds since epoch (1970)
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • before

      public boolean before​(Btime other)
    • after

      public boolean after​(Btime other)
    • afterOrEquals

      public boolean afterOrEquals​(Btime other)
    • convertToCalendar

      public java.util.Calendar convertToCalendar()
    • toString

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

      public int getYear()
    • getDayOfYear

      public int getDayOfYear()
    • getJDay

      public int getJDay()
    • getHour

      public int getHour()
    • getMin

      public int getMin()
    • getSec

      public int getSec()
    • getTenthMilli

      public int getTenthMilli()
    • shouldSwapBytes

      public static boolean shouldSwapBytes​(byte[] btime)
      Expects btime to be a byte array pointing at the beginning of a btime segment
      Returns:
      - true if the bytes need to be swapped to get a valid year
    • shouldSwapBytes

      public static boolean shouldSwapBytes​(byte[] btime, int offset)
      Expects btime to be a byte array pointing at the beginning of a btime segment. Time capsule: note that year 2056 as a short byte swaps to itself, so whomever is maintaining this code off in the distant future, 49 years from now as I write this in 2007, should find some other header to use for byte swap checking! Using the jday or tenthmilli doesn't help much as 1 byte swaps to 256, 256 to 1 and 257 to itself. If mseed was going to support little endian headers they should have put in a damn flag! - HPC
      Returns:
      - true if the bytes need to be swapped to get a valid year
    • getAsBytes

      public byte[] getAsBytes()