|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.parabola.imgfmt.Utils
public class Utils
Some miscellaneous functions that are used within the .img code.
Constructor Summary | |
---|---|
Utils()
|
Method Summary | |
---|---|
static java.lang.String |
bytesToString(java.nio.ByteBuffer buf,
int off,
int len)
Convert from bytes to a string. |
static void |
closeFile(java.io.Closeable f)
|
static java.lang.String |
joinPath(java.lang.String dir,
java.lang.String basename)
|
static java.lang.String |
joinPath(java.lang.String dir,
java.lang.String basename,
java.lang.String ext)
|
static java.util.Date |
makeCreationTime(byte[] date)
Make a date from the garmin representation. |
static byte[] |
makeCreationTime(java.util.Date date)
Convert a date into the in-file representation of a date. |
static java.io.InputStream |
openFile(java.lang.String name)
Open a file and apply filters necessary for reading it such as decompression. |
static void |
setCreationTime(java.nio.ByteBuffer buf,
java.util.Date date)
Set the creation date. |
static byte[] |
toBytes(java.lang.String s)
|
static byte[] |
toBytes(java.lang.String s,
int len,
byte pad)
Routine to convert a string to bytes and pad with a character up to a given length. |
static double |
toDegrees(int val)
Convert an angle in map units to degrees. |
static int |
toMapUnit(double l)
A map unit is an integer value that is 1/(2^24) degrees of latitude or longitude. |
static double |
toRadians(int mapunits)
Convert an angle in map units to radians. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static byte[] toBytes(java.lang.String s, int len, byte pad)
s
- The original string.len
- The length to pad to.pad
- The byte used to pad.
public static byte[] toBytes(java.lang.String s)
public static java.lang.String bytesToString(java.nio.ByteBuffer buf, int off, int len)
buf
- A byte buffer to get the bytes from. Should be ascii or latin1.off
- The offset into buf.len
- The length to get.
public static void setCreationTime(java.nio.ByteBuffer buf, java.util.Date date)
buf
- The buffer to write into. It must have been properly positioned
beforehand.date
- The date to set.public static int toMapUnit(double l)
l
- The lat or long as decimal degrees.
public static byte[] makeCreationTime(java.util.Date date)
date
- The date.
public static java.util.Date makeCreationTime(byte[] date)
date
- The bytes representing the date.
public static double toDegrees(int val)
public static double toRadians(int mapunits)
public static void closeFile(java.io.Closeable f)
public static java.io.InputStream openFile(java.lang.String name) throws java.io.FileNotFoundException
name
- The file to open.
java.io.FileNotFoundException
- If the file cannot be opened for any reason.public static java.lang.String joinPath(java.lang.String dir, java.lang.String basename, java.lang.String ext)
public static java.lang.String joinPath(java.lang.String dir, java.lang.String basename)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |