org.apache.poi.hpsf
@Internal public class Util extends java.lang.Object
Provides various static utility methods.
Modifier and Type | Field and Description |
---|---|
static long |
EPOCH_DIFF
The difference between the Windows epoch (1601-01-01
00:00:00) and the Unix epoch (1970-01-01 00:00:00) in
milliseconds: 11644473600000L.
|
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static long |
dateToFileTime(java.util.Date date)
Converts a
Date into a filetime. |
static boolean |
equals(java.lang.Object[] c1,
java.lang.Object[] c2)
Compares to object arrays with regarding the objects' order.
|
static java.util.Date |
filetimeToDate(int high,
int low)
Converts a Windows FILETIME into a
Date . |
static java.util.Date |
filetimeToDate(long filetime)
Converts a Windows FILETIME into a
Date . |
static byte[] |
pad4(byte[] ba)
Pads a byte array with 0x00 bytes so that its length is a multiple of
4.
|
static java.lang.String |
toString(java.lang.Throwable t)
Returns a textual representation of a
Throwable , including a
stacktrace. |
public static final long EPOCH_DIFF
The difference between the Windows epoch (1601-01-01 00:00:00) and the Unix epoch (1970-01-01 00:00:00) in milliseconds: 11644473600000L. (Use your favorite spreadsheet program to verify the correctness of this value. By the way, did you notice that you can tell from the epochs which operating system is the modern one? :-))
public static java.util.Date filetimeToDate(int high, int low)
Converts a Windows FILETIME into a Date
. The Windows
FILETIME structure holds a date and time associated with a
file. The structure identifies a 64-bit integer specifying the
number of 100-nanosecond intervals which have passed since
January 1, 1601. This 64-bit value is split into the two double
words stored in the structure.
high
- The higher double word of the FILETIME structure.low
- The lower double word of the FILETIME structure.Date
.public static java.util.Date filetimeToDate(long filetime)
Converts a Windows FILETIME into a Date
. The Windows
FILETIME structure holds a date and time associated with a
file. The structure identifies a 64-bit integer specifying the
number of 100-nanosecond intervals which have passed since
January 1, 1601.
filetime
- The filetime to convert.Date
.public static long dateToFileTime(java.util.Date date)
Converts a Date
into a filetime.
date
- The date to be convertedfiletimeToDate(long)
,
filetimeToDate(int, int)
public static boolean equals(java.lang.Object[] c1, java.lang.Object[] c2)
Compares to object arrays with regarding the objects' order. For example, [1, 2, 3] and [2, 1, 3] are equal.
c1
- The first object array.c2
- The second object array.true
if the object arrays are equal,
false
if they are not.public static byte[] pad4(byte[] ba)
Pads a byte array with 0x00 bytes so that its length is a multiple of 4.
ba
- The byte array to pad.public static java.lang.String toString(java.lang.Throwable t)
Returns a textual representation of a Throwable
, including a
stacktrace.
t
- The Throwable
t.printStacktrace()
.Copyright 2017 The Apache Software Foundation or its licensors, as applicable.