|
|||||||||
| 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 long |
DIFF_BETWEEN_ASF_DATE_AND_JAVA_DATE
|
static java.lang.String |
LINE_SEPARATOR
Stores the default line separator of the current underlying system. |
private static int |
MAXIMUM_STRING_LENGTH_ALLOWED
|
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | |
|---|---|
static void |
checkStringLengthNullSafe(java.lang.String value)
This method checks given string will not exceed limit in bytes[] when converted UTF-16LE encoding (2 bytes per character) and checks whether the length doesn't exceed 65535 bytes. |
static void |
copy(java.io.InputStream source,
java.io.OutputStream dest,
long amount)
effectively copies a specified amount of bytes from one stream to another. |
static void |
flush(java.io.InputStream source,
java.io.OutputStream dest)
Copies all of the source to the destination. |
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 byte[] |
getBytes(java.lang.String source,
java.nio.charset.Charset charset)
Convenience method to convert the given string into a byte sequence which has the format of the charset given. |
static java.util.GregorianCalendar |
getDateOf(java.math.BigInteger fileTime)
Date values in ASF files are given in 100 ns (10 exp -4) steps since first |
static boolean |
isBlank(java.lang.String toTest)
Tests if the given string is null or just contains
whitespace characters. |
static boolean |
isStringLengthValidNullSafe(java.lang.String value)
|
static java.math.BigInteger |
readBig64(java.io.InputStream stream)
Reads 8 bytes from stream and interprets them as a UINT64 which is returned as BigInteger. |
static byte[] |
readBinary(java.io.InputStream stream,
long size)
Reads size bytes from the stream. |
static java.lang.String |
readCharacterSizedString(java.io.InputStream stream)
This method reads a UTF-16 String, which length is given on the number of characters it consists of. |
static java.lang.String |
readFixedSizeUTF16Str(java.io.InputStream stream,
int strLen)
This method reads a UTF-16 encoded String. |
static GUID |
readGUID(java.io.InputStream stream)
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.InputStream stream)
Reads 2 bytes from stream and interprets them as UINT16. |
static long |
readUINT32(java.io.InputStream stream)
Reads 4 bytes from stream and interprets them as UINT32. |
static long |
readUINT64(java.io.InputStream stream)
Reads long as little endian. |
static java.lang.String |
readUTF16LEStr(java.io.InputStream stream)
This method reads a UTF-16 encoded String, beginning with a 16-bit value representing the number of bytes needed. |
static void |
writeUINT16(int number,
java.io.OutputStream out)
Writes the given value as UINT16 into the stream. |
static void |
writeUINT32(long number,
java.io.OutputStream out)
Writes the given value as UINT32 into the stream. |
static void |
writeUINT64(long number,
java.io.OutputStream out)
Writes the given value as UINT64 into the stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long DIFF_BETWEEN_ASF_DATE_AND_JAVA_DATE
public static final java.lang.String LINE_SEPARATOR
private static final int MAXIMUM_STRING_LENGTH_ALLOWED
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
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.public static boolean isStringLengthValidNullSafe(java.lang.String value)
value - String to check for null
public static void copy(java.io.InputStream source,
java.io.OutputStream dest,
long amount)
throws java.io.IOException
source - stream to read fromdest - stream to write toamount - amount of bytes to copy
java.io.IOException - on I/O errors, and if the source stream depletes before all
bytes have been copied.
public static void flush(java.io.InputStream source,
java.io.OutputStream dest)
throws java.io.IOException
source - source to read fromdest - stream to write to
java.io.IOException - on I/O errors.
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 byte[] getBytes(java.lang.String source,
java.nio.charset.Charset charset)
source - string to convert.charset - charset to apply
public static java.util.GregorianCalendar getDateOf(java.math.BigInteger fileTime)
fileTime - Time in 100ns since 1 jan 1601
public static boolean isBlank(java.lang.String toTest)
null or just contains
whitespace characters.
toTest - String to test.
public static java.math.BigInteger readBig64(java.io.InputStream stream)
throws java.io.IOException
BigInteger.
stream - stream to readm from.
java.io.IOException - if problem reading bytes
public static byte[] readBinary(java.io.InputStream stream,
long size)
throws java.io.IOException
size bytes from the stream.
stream - stream to read from.size - amount of bytes to read.
java.io.IOException - on I/O errors.
public static java.lang.String readCharacterSizedString(java.io.InputStream stream)
throws java.io.IOException
stream - Input source
java.io.IOException - read errors
public static java.lang.String readFixedSizeUTF16Str(java.io.InputStream stream,
int strLen)
throws java.io.IOException
stream - Input sourcestrLen - Number of bytes the String may take.
java.io.IOException - read errors.
public static GUID readGUID(java.io.InputStream stream)
throws java.io.IOException
raf and creates a wrapper.
stream - Input source.
java.io.IOException - happens when the file ends before guid could be extracted.
public static int readUINT16(java.io.InputStream stream)
throws java.io.IOException
stream - stream to read from.
java.io.IOException - on I/O Errors.
public static long readUINT32(java.io.InputStream stream)
throws java.io.IOException
stream - stream to read from.
java.io.IOException - on I/O Errors.
public static long readUINT64(java.io.InputStream stream)
throws java.io.IOException
stream - Data source
java.io.IOException - read error, or eof is reached before long is completed
public static java.lang.String readUTF16LEStr(java.io.InputStream stream)
throws java.io.IOException
stream - Input source
java.io.IOException - read errors.
public static void writeUINT16(int number,
java.io.OutputStream out)
throws java.io.IOException
number - value to write.out - stream to write into.
java.io.IOException - On I/O errors
public static void writeUINT32(long number,
java.io.OutputStream out)
throws java.io.IOException
number - value to write.out - stream to write into.
java.io.IOException - On I/O errors
public static void writeUINT64(long number,
java.io.OutputStream out)
throws java.io.IOException
number - value to write.out - stream to write into.
java.io.IOException - On I/O errors
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||