|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object entagged.audioformats.asf.util.Utils
public class Utils
Some static Methods which are used in several Classes.
Field Summary | |
---|---|
static String |
LINE_SEPARATOR
Stores the default line seperator of the current underlying system. |
Constructor Summary | |
---|---|
Utils()
|
Method Summary | |
---|---|
static void |
checkStringLengthNullSafe(String value)
This method converts the given string into a byte[] in UTF-16LE encoding and checks whether the length doesn't exceed 65535 bytes. |
static void |
fillChars(char[] chars,
RandomAccessFile raf)
Reads chars out of raf until chars is
filled. |
static byte[] |
getBytes(long value,
int byteCount)
This method will create a byte[] at the size of byteCount
and insert the bytes of value (starting from lowset byte)
into it. |
static GregorianCalendar |
getDateOf(BigInteger fileTime)
Since date values in asf files are given in 100 ns steps since first january of 1601 a little conversion must be done. |
static int |
read7Bit(RandomAccessFile raf)
This method reads one byte from raf and creates an
unsigned value of it. |
static BigInteger |
readBig64(RandomAccessFile raf)
This method reads 8 bytes, interprets them as an unsigned number and creates a BigInteger |
static String |
readCharacterSizedString(RandomAccessFile raf)
This method reads a UTF-16 String, which legth is given on the number of characters it consits of. |
static GUID |
readGUID(RandomAccessFile raf)
This Method reads a GUID (which is a 16 byte long sequence) from the given raf and creates a wrapper. |
static int |
readUINT16(RandomAccessFile raf)
|
static long |
readUINT32(RandomAccessFile raf)
|
static long |
readUINT64(RandomAccessFile raf)
Reads long as little endian. |
static String |
readUTF16LEStr(RandomAccessFile raf)
This method reads a UTF-16 encoded String, beginning with a 16-bit value representing the number of bytes needed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String LINE_SEPARATOR
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static void fillChars(char[] chars, RandomAccessFile raf) throws IOException
raf
until chars
is
filled.
chars
- to be filledraf
- to be read
IOException
- read error, or file at end before chars
is
filled.public static byte[] getBytes(long value, int byteCount)
byteCount
and insert the bytes of value
(starting from lowset byte)
into it.
value
- The value to be written into the result.byteCount
- The number of bytes the array has got.
byteCount
containing the
lower byte values of value
.public static GregorianCalendar getDateOf(BigInteger fileTime)
fileTime
- Time in 100ns since 1 jan 1601
public static int read7Bit(RandomAccessFile raf) throws IOException
raf
and creates an
unsigned value of it.
raf
- The file to read from.
IOException
- read errors.public static BigInteger readBig64(RandomAccessFile raf) throws IOException
BigInteger
raf
- Input source
IOException
- read errors.public static String readCharacterSizedString(RandomAccessFile raf) throws IOException
raf
must be at the number of
characters. This number contains the terminating zero character (UINT16).
raf
- Input source
IOException
- read errorspublic static GUID readGUID(RandomAccessFile raf) throws IOException
raf
and creates a wrapper.
raf
- Input source.
IOException
- happens when the file ends before guid could be extracted.public static int readUINT16(RandomAccessFile raf) throws IOException
raf
-
IOException
readUINT64(RandomAccessFile)
public static long readUINT32(RandomAccessFile raf) throws IOException
raf
-
IOException
readUINT64(RandomAccessFile)
public static long readUINT64(RandomAccessFile raf) throws IOException
raf
- Data source
IOException
- read error, or eof is reached before long is completedpublic static String readUTF16LEStr(RandomAccessFile raf) throws IOException
raf
- Input source
IOException
- read errors.public static void checkStringLengthNullSafe(String value) throws IllegalArgumentException
value
- The string to check.
IllegalArgumentException
- If byte representation takes more than 65535 bytes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |