|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.generic.Utils
public class Utils
Contains various frequently used static functions in the different tag formats
Field Summary | |
---|---|
static java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
Utils()
|
Method Summary | |
---|---|
static void |
copy(byte[] src,
byte[] dst,
int dstOffset)
Copies the bytes of srd to dst at the
specified offset. |
static boolean |
copy(java.io.File fromFile,
java.io.File toFile)
Copy a File |
static byte[] |
getDefaultBytes(java.lang.String s,
java.lang.String charSet)
Returns String.getBytes() . |
static java.lang.String |
getExtension(java.io.File f)
|
static int |
getIntBE(byte[] b,
int start,
int end)
|
static int |
getIntBE(java.nio.ByteBuffer b,
int start,
int end)
|
static int |
getIntLE(byte[] b)
|
static int |
getIntLE(byte[] b,
int start,
int end)
|
static long |
getLongBE(java.nio.ByteBuffer b,
int start,
int end)
|
static long |
getLongLE(java.nio.ByteBuffer b,
int start,
int end)
|
static java.lang.String |
getMinBaseFilenameAllowedForTempFile(java.io.File file)
|
static short |
getShortBE(java.nio.ByteBuffer b,
int start,
int end)
|
static byte[] |
getSizeBEInt16(short size)
Convert short to byte representation - Big Endian (as used by mp4) |
static byte[] |
getSizeBEInt32(int size)
Convert int to byte representation - Big Endian (as used by mp4) |
static byte[] |
getSizeLEInt32(int size)
Convert int to byte representation - Little Endian (as used by ogg vorbis) |
static java.lang.String |
getString(byte[] b,
int offset,
int length,
java.lang.String encoding)
Create String starting from offset upto length using encoding |
static java.lang.String |
getString(java.nio.ByteBuffer buffer,
int offset,
int length,
java.lang.String encoding)
Create String offset from position by offset upto length using encoding, and position of buffer is moved to after position + offset + length |
static byte[] |
getUTF8Bytes(java.lang.String s)
|
static int |
read(java.nio.ByteBuffer b)
|
static java.lang.String |
readString(java.io.DataInput di,
int charsToRead)
|
static int |
readUBEInt16(java.nio.ByteBuffer b)
|
static int |
readUBEInt24(java.nio.ByteBuffer b)
|
static int |
readUBEInt32(java.nio.ByteBuffer b)
|
static int |
readUint16(java.io.DataInput di)
|
static long |
readUint32(java.io.DataInput di)
|
static int |
readUint32AsInt(java.io.DataInput di)
Overflow checking since java can't handle unsigned numbers. |
static long |
readUInt64(java.nio.ByteBuffer b)
|
static int |
readUInt8(java.nio.ByteBuffer b)
|
static boolean |
rename(java.io.File fromFile,
java.io.File toFile)
Rename file, and if normal rename fails, try copy and delete instead |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.logging.Logger logger
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static void copy(byte[] src, byte[] dst, int dstOffset)
srd
to dst
at the
specified offset.
src
- The byte to be copied.dst
- The array to copy todstOffset
- The start offset for the bytes to be copied.public static byte[] getDefaultBytes(java.lang.String s, java.lang.String charSet)
String.getBytes()
.
s
- The String to call, decode bytes using the specfied charsetcharSet
-
public static java.lang.String getExtension(java.io.File f)
public static long getLongLE(java.nio.ByteBuffer b, int start, int end)
public static long getLongBE(java.nio.ByteBuffer b, int start, int end)
public static int getIntLE(byte[] b)
public static int getIntLE(byte[] b, int start, int end)
public static int getIntBE(byte[] b, int start, int end)
public static int getIntBE(java.nio.ByteBuffer b, int start, int end)
public static short getShortBE(java.nio.ByteBuffer b, int start, int end)
public static byte[] getSizeBEInt32(int size)
size
-
public static byte[] getSizeBEInt16(short size)
size
-
public static byte[] getSizeLEInt32(int size)
size
-
public static java.lang.String getString(byte[] b, int offset, int length, java.lang.String encoding)
b
- offset
- length
- encoding
-
java.io.UnsupportedEncodingException
public static java.lang.String getString(java.nio.ByteBuffer buffer, int offset, int length, java.lang.String encoding)
buffer
- offset
- length
- encoding
-
public static byte[] getUTF8Bytes(java.lang.String s) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public static int readUint32AsInt(java.io.DataInput di) throws java.io.IOException
di
-
java.io.IOException
public static long readUint32(java.io.DataInput di) throws java.io.IOException
java.io.IOException
public static int readUint16(java.io.DataInput di) throws java.io.IOException
java.io.IOException
public static java.lang.String readString(java.io.DataInput di, int charsToRead) throws java.io.IOException
java.io.IOException
public static long readUInt64(java.nio.ByteBuffer b)
public static int readUBEInt32(java.nio.ByteBuffer b)
public static int readUBEInt24(java.nio.ByteBuffer b)
public static int readUBEInt16(java.nio.ByteBuffer b)
public static int readUInt8(java.nio.ByteBuffer b)
public static int read(java.nio.ByteBuffer b)
public static java.lang.String getMinBaseFilenameAllowedForTempFile(java.io.File file)
file
-
public static boolean rename(java.io.File fromFile, java.io.File toFile)
fromFile
- toFile
-
public static boolean copy(java.io.File fromFile, java.io.File toFile)
fromFile
- The existing FiletoFile
- The new File
true
if and only if the renaming succeeded;
false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |