|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgsfc.nssdc.cdf.util.Epoch16
public class Epoch16
This class contains the handy utility routines (methods) called by the CDF applications to handle epoch data of CDF's CDF_EPOCH16 data type.
// Get the time, down to picoseconds, for Aug 5, 1990 at 5:0:0.0.0.0
double[] epoch16 = new double[2];
double ep = Epoch16.compute(1990, 8, 5, 5, 0, 0, 0, 0, 0, 0, epoch16);
//Get the year, month, day, hour, minutes, seconds, milliseconds,
// microseconds, nanaseconds and picoseconds for epoch16
long times[] = Epoch16.breakdown(epoch16);
for (int i=0;i<times.length;i++)
System.out.print(times[i]+" ");
System.out.println();
// Printout the epoch in various formats
System.out.println(Epoch16.encode(epoch16));
System.out.println(Epoch16.encode1(epoch16));
System.out.println(Epoch16.encode2(epoch16));
System.out.println(Epoch16.encode3(epoch16));
System.out.println(Epoch16.encode4(epoch16));
// Print out the date using format
String format = " , at :";
System.out.println(Epoch16.encodex(epoch16,format));
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
Epoch16()
|
|
| Method Summary | |
|---|---|
static long[] |
breakdown(java.lang.Object epoch)
Breaks an EPOCH16 value down into its component parts. |
static double |
compute(long year,
long month,
long day,
long hour,
long minute,
long second,
long msec,
long usec,
long nsec,
long psec,
java.lang.Object epoch)
Computes an EPOCH16 value based on its component parts. |
static java.lang.String |
encode(java.lang.Object epoch)
Converts an EPOCH16 value into a readable date/time string. |
static java.lang.String |
encode1(java.lang.Object epoch)
Converts an EPOCH16 value into a readable date/time string. |
static java.lang.String |
encode2(java.lang.Object epoch)
Converts an EPOCH16 value into a readable date/time string. |
static java.lang.String |
encode3(java.lang.Object epoch)
Converts an EPOCH16 value into a readable date/time string. |
static java.lang.String |
encode4(java.lang.Object epoch)
Converts an EPOCH16 value into a readable date/time, ISO8601 string. |
static java.lang.String |
encodex(java.lang.Object epoch,
java.lang.String formatString)
Converts an EPOCH16 value into a readable date/time string using the specified format. |
static java.lang.Object |
parse(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH16 value. |
static java.lang.Object |
parse1(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH16 value. |
static java.lang.Object |
parse2(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH16 value. |
static java.lang.Object |
parse3(java.lang.String inString)
This function parses an input date/time string and returns an EPOCH16 value. |
static java.lang.Object |
parse4(java.lang.String inString)
This function parses an input date/time, ISO8601 string and returns an EPOCH16 value. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Epoch16()
| Method Detail |
|---|
public static java.lang.Object parse(java.lang.String inString)
throws CDFException
Format: dd-mmm-yyyy hh:mm:ss.ccc.mmm.nnn.ppp
Examples: 1-Apr-1990 03:05:02.000.000.000.000
10-Oct-1993 23:45:49.999.999.999.999
The expected format is the same as that produced by encode.
inString - the epoch in string representation
CDFException - if a bad epoch value is passed in inString
public static java.lang.Object parse1(java.lang.String inString)
throws CDFException
Format: yyyymmdd.ttttttttttttttt
Examples: 19950508.000000000000000
19671231.58 (== 19671213.580000000000000)
The expected format is the same as that produced by encode1.
inString - the epoch in string representation
CDFException - if a bad epoch value is passed in inString
public static java.lang.Object parse2(java.lang.String inString)
throws CDFException
Format: yyyymmddhhmmss
Examples: 19950508000000
19671231235959
The expected format is the same as that produced by encode2.
inString - the epoch in string representation
CDFException - if a bad epoch value is passed in inString
public static java.lang.Object parse3(java.lang.String inString)
throws CDFException
Format: yyyy-mm-ddThh:mm:ss.ccc.mmm.nnn.pppZ
Examples: 1990-04-01T03:05:02.000.000.000.000Z
1993-10-10T23:45:49.999.999.999.999Z
The expected format is the same as that produced by encode3.
inString - the epoch in string representation
CDFException - if a bad epoch value is passed in inString
public static java.lang.Object parse4(java.lang.String inString)
throws CDFException
Format: yyyy-mm-ddThh:mm:ss.cccmmmnnnppp
Examples: 1990-04-01T03:05:02.000000000000
1993-10-10T23:45:49.999999999999
The expected format is the same as that produced by encode3.
inString - the epoch in string representation
CDFException - if a bad epoch value is passed in inStringpublic static java.lang.String encode(java.lang.Object epoch)
Format: dd-mmm-yyyy hh:mm:ss.ccc.mmm.nnn.ppp
Examples: 01-Apr-1990 03:05:02.000.000.000.000
10-Oct-1993 23:45:49.999.999.999.999
This format is the same as that expected by parse.
epoch - the epoch value
public static java.lang.String encode1(java.lang.Object epoch)
Format: yyyymmdd.ttttttttttttttt
Examples: 19900401.365889312341234
19611231.000000000000000
This format is the same as that expected by parse1.
epoch - the epoch value
public static java.lang.String encode2(java.lang.Object epoch)
Format: yyyymmddhhmmss
Examples: 19900401235959
19611231000000
This format is the same as that expected by parse2.
epoch - the epoch value
public static java.lang.String encode3(java.lang.Object epoch)
Format: yyyy-mm-ddThh:mm:ss.ccc.mmm.nnn.pppZ
Examples: 1990-04-01T03:05:02.000.000.000.000Z
1993-10-10T23:45:49.999.999.999.999Z
This format is the same as that expected by parse3.
epoch - the epoch value
public static java.lang.String encode4(java.lang.Object epoch)
Format: yyyy-mm-ddThh:mm:ss.cccmmmnnnppp
Examples: 1990-04-01T03:05:02.000000000000
1993-10-10T23:45:49.999999999999
This format is the same as that expected by parse4.
epoch - the epoch value
public static java.lang.String encodex(java.lang.Object epoch,
java.lang.String formatString)
epoch - the epoch valueformatString - a string representing the desired
format of the epoch
public static double compute(long year,
long month,
long day,
long hour,
long minute,
long second,
long msec,
long usec,
long nsec,
long psec,
java.lang.Object epoch)
throws CDFException
year - the yearmonth - the monthday - the dayhour - the hourminute - the minutesecond - the secondmsec - the millisecondsusec - the microsecondsnsec - the nanosecondspsec - the picoseconds
CDFException - an ILLEGAL_EPOCH_FIELD if an illegal
component value is detected.public static long[] breakdown(java.lang.Object epoch)
epoch - the epoch value to break down
| Index | Part |
| 0 | year |
| 1 | month |
| 2 | day |
| 3 | hour |
| 4 | minute |
| 5 | second |
| 6 | msec |
| 7 | usec |
| 8 | nsec |
| 9 | psec |
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||