|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jaudiotagger.audio.asf.util.Utils
public class Utils
Some static Methods which are used in several Classes.
Field Summary | |
---|---|
static java.lang.String |
LINE_SEPARATOR
Stores the default line seperator of the current underlying system. |
Constructor Summary | |
---|---|
Utils()
|
Method Summary | |
---|---|
static void |
checkStringLengthNullSafe(java.lang.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,
java.io.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 java.util.GregorianCalendar |
getDateOf(java.math.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(java.io.RandomAccessFile raf)
This method reads one byte from raf and creates an
unsigned value of it. |
static java.math.BigInteger |
readBig64(java.io.RandomAccessFile raf)
This method reads 8 bytes, interprets them as an unsigned number and creates a BigInteger |
static java.lang.String |
readCharacterSizedString(java.io.RandomAccessFile raf)
This method reads a UTF-16 String, which legth is given on the number of characters it consits of. |
static GUID |
readGUID(java.io.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(java.io.RandomAccessFile raf)
|
static long |
readUINT32(java.io.RandomAccessFile raf)
|
static long |
readUINT64(java.io.RandomAccessFile raf)
Reads long as little endian. |
static java.lang.String |
readUTF16LEStr(java.io.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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LINE_SEPARATOR
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static void fillChars(char[] chars, java.io.RandomAccessFile raf) throws java.io.IOException
raf
until chars
is
filled.
chars
- to be filledraf
- to be read
java.io.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 java.util.GregorianCalendar getDateOf(java.math.BigInteger fileTime)
fileTime
- Time in 100ns since 1 jan 1601
public static int read7Bit(java.io.RandomAccessFile raf) throws java.io.IOException
raf
and creates an
unsigned value of it.
raf
- The file to read from.
java.io.IOException
- read errors.public static java.math.BigInteger readBig64(java.io.RandomAccessFile raf) throws java.io.IOException
BigInteger
raf
- Input source
java.io.IOException
- read errors.public static java.lang.String readCharacterSizedString(java.io.RandomAccessFile raf) throws java.io.IOException
raf
must be at the number of
characters. This number contains the terminating zero character (UINT16).
raf
- Input source
java.io.IOException
- read errorspublic static GUID readGUID(java.io.RandomAccessFile raf) throws java.io.IOException
raf
and creates a wrapper.
raf
- Input source.
java.io.IOException
- happens when the file ends before guid could be extracted.public static int readUINT16(java.io.RandomAccessFile raf) throws java.io.IOException
raf
-
java.io.IOException
readUINT64(RandomAccessFile)
public static long readUINT32(java.io.RandomAccessFile raf) throws java.io.IOException
raf
-
java.io.IOException
readUINT64(RandomAccessFile)
public static long readUINT64(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- Data source
java.io.IOException
- read error, or eof is reached before long is completedpublic static java.lang.String readUTF16LEStr(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- Input source
java.io.IOException
- read errors.public static void checkStringLengthNullSafe(java.lang.String value) throws java.lang.IllegalArgumentException
value
- The string to check.
java.lang.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 |