Package edu.sc.seis.seisFile.mseed
Class Btime
- java.lang.Object
-
- edu.sc.seis.seisFile.mseed.Btime
-
public class Btime extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Btime()Btime(byte[] bytes)Btime(byte[] bytes, int offset)Btime(byte[] bytes, int offset, boolean byteSwapFlag)Btime(double d)Create with seconds since epoch (1970)Btime(int year, int jday, int hour, int min, int sec, int tenthMilli)Btime(java.time.Instant date)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanafter(Btime other)booleanafterOrEquals(Btime other)booleanbefore(Btime other)booleanequals(java.lang.Object o)byte[]getAsBytes()intgetDayOfYear()intgetHour()intgetJDay()intgetMin()intgetSec()intgetTenthMilli()intgetYear()inthashCode()static booleanshouldSwapBytes(byte[] btime)Expects btime to be a byte array pointing at the beginning of a btime segmentstatic booleanshouldSwapBytes(byte[] btime, int offset)Expects btime to be a byte array pointing at the beginning of a btime segment.java.time.InstanttoInstant()java.lang.StringtoString()
-
-
-
Field Detail
-
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
-
MIN_YEAR
public static int MIN_YEAR
-
MAX_YEAR
public static int MAX_YEAR
-
MIN_JDAY
public static int MIN_JDAY
-
MAX_JDAY
public static int MAX_JDAY
-
-
Constructor Detail
-
Btime
public Btime(java.time.Instant 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(byte[] bytes, int offset, boolean byteSwapFlag)
-
Btime
public Btime(double d)
Create with seconds since epoch (1970)
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
before
public boolean before(Btime other)
-
after
public boolean after(Btime other)
-
afterOrEquals
public boolean afterOrEquals(Btime other)
-
toInstant
public java.time.Instant toInstant()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.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! Also, 1800 swaps to 2055, so careful on the low end as well. Other swaps that overlap (in 1800 to 2500 range) are: 1800 2055 1801 2311 2055 1800 2056 2056 2057 2312 2311 1801 2312 2057 2313 2313 So, 1802 to 2310 are a safe "good" year range, with the exception of 2056 Using the jday helps but isn't definitive as 1 byte swaps to 256, 256 to 1 and 257 to itself. Similar tenthmilli has same as jday as well as 3 swaps to 768 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/jday, false if not needed or if it is not determinable (year 2056).
-
getAsBytes
public byte[] getAsBytes()
-
-