|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.common.ThingsUtilityBelt
public class ThingsUtilityBelt
A grab bag of static utilities.
Version History
EPG - Initial - 16 JUN 01 EPG - add snap strings 20 AUG 04 EPG - added load file to array - 9 JUL 07 EPG - make everything GMT - 10 AUG 08
Field Summary | |
---|---|
static char[] |
HEX_VALUES
|
Constructor Summary | |
---|---|
ThingsUtilityBelt()
|
Method Summary | |
---|---|
static java.lang.String |
binaryNameToFileName(java.lang.String name)
Convert the binary name to the file name. |
static void |
copy(java.io.InputStream is,
java.io.OutputStream out,
int bufferSize)
A copier. |
static void |
destroyFile(java.io.File theFile)
Make sure a file is deleted for sure. |
static java.lang.String |
hexFormatter16bit(int value)
Format a integer as a 4 digit hex. |
static java.lang.String |
hexFormatter8bit(byte[] value)
Format a byte array as 2 digit hex. |
static byte[] |
loadFileToArray(java.io.File file)
Load a file into an array. |
static byte[] |
loadFileToArray(java.lang.String path)
Load a file into an array. |
static int |
nextInteger()
Next integer starting with 1. |
static long |
parseTimestampYYYYDDDHHMMSSmmmm(java.lang.String stamp)
A timestamp for matter for year,day,hour,minutes,seconds. |
static java.lang.String[] |
snapStrings(java.lang.String target,
int firstRun,
int followingRuns)
Snap a string into sized pieces. |
static java.lang.String |
timestampFormatterDDDHHMMSS(long time)
A timestamp for matter for day:hour,minutes,seconds. |
static java.lang.String |
timestampFormatterHHMMSS()
A timestamp for matter for hour,minutes,seconds. |
static java.lang.String |
timestampFormatterHHMMSS(long time)
A timestamp for matter for hour,minutes,seconds. |
static java.lang.String |
timestampFormatterYYYYDDDHHMMSSmmmm()
A timestamp for matter for year,day,hour,minutes,seconds. |
static java.lang.String |
timestampFormatterYYYYDDDHHMMSSmmmm(long time)
A timestamp for matter for year,day,hour,minutes,seconds. |
static long |
timestampYYYYMMDD(java.lang.String text)
Parse a YYYYMMDD string into a timestamp (millis from epoch). |
static long |
timestampYYYYMMDDHHMMSS(java.lang.String text)
Parse a YYYYMMDDHHMMSS string into a timestamp (millis from epoch). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char[] HEX_VALUES
Constructor Detail |
---|
public ThingsUtilityBelt()
Method Detail |
---|
public static java.lang.String timestampFormatterHHMMSS()
public static long timestampYYYYMMDD(java.lang.String text) throws java.lang.Throwable
text
-
java.lang.Throwable
- if the format is null or bad.public static long timestampYYYYMMDDHHMMSS(java.lang.String text) throws java.lang.Throwable
text
-
java.lang.Throwable
- if the format is null or bad.public static java.lang.String timestampFormatterHHMMSS(long time)
time
- timestamp in milliseconds
public static java.lang.String timestampFormatterDDDHHMMSS(long time)
time
- timestamp in milliseconds
public static java.lang.String timestampFormatterYYYYDDDHHMMSSmmmm()
public static java.lang.String timestampFormatterYYYYDDDHHMMSSmmmm(long time)
time
- timestamp in milliseconds.
public static long parseTimestampYYYYDDDHHMMSSmmmm(java.lang.String stamp) throws java.lang.Throwable
stamp
- timestamp in milliseconds.
java.lang.Throwable
public static java.lang.String hexFormatter16bit(int value)
value
- the value to render as hex.
public static java.lang.String hexFormatter8bit(byte[] value)
value
- bytes to format.
public static byte[] loadFileToArray(java.lang.String path) throws java.io.IOException
path
- the String path to the file.
java.io.IOException
public static byte[] loadFileToArray(java.io.File file) throws java.io.IOException
file
-
java.io.IOException
public static java.lang.String binaryNameToFileName(java.lang.String name) throws java.lang.Exception
name
- The binary name.
an
- Exception if it encounters disallowed character--slashes, CR, LF, Space, or TAB.
java.lang.Exception
public static int nextInteger() throws java.lang.ArithmeticException
java.lang.ArithmeticException
- if it overflows.public static void destroyFile(java.io.File theFile) throws ThingsException
theFile
- The file to smack!
ThingsException
- if it wouldn't deleted after several attempts.public static java.lang.String[] snapStrings(java.lang.String target, int firstRun, int followingRuns)
target
- the string to snap.firstRun
- the size in characters of the first run.followingRuns
- the size of all following runs.
public static void copy(java.io.InputStream is, java.io.OutputStream out, int bufferSize) throws java.lang.Exception
is
- input stream.out
- output stream.bufferSize
- The buffer size.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |