|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dusbabek.lib.id3.ByteUtils
public class ByteUtils
Utilities for converting long to bytes and vice versa. Please note that the longs I deal with are only 4 bytes in size (not 8). I could have gotten away with using ints, but java has a nasty habit of using sign extension which would have foiled me for large UNSIGNED values.
Constructor Summary | |
---|---|
ByteUtils()
|
Method Summary | |
---|---|
static long |
addZeroBits(long l)
Unique to Id3s. |
static long |
byte3ToLong(byte[] b,
int offset)
convert a 3 byte array to an 8 byte long. |
static long |
byte4ToLong(byte[] b,
int offset)
convert a 4 byte array to an 8 byte long. |
static java.lang.String |
byteToString(byte b)
|
static byte[] |
longToByte3(long l)
convert long to 3 byte array. |
static byte[] |
longToByte4(long l)
convert long to 4 byte array. |
static long |
removeZeroBits(long l)
This is unique to Id3s. |
static byte[] |
sync(byte[] data)
|
static byte[] |
unsync(byte[] data)
|
static byte[] |
zip_expand(byte[] b,
long size)
decompress data using ZLIB. |
static byte[] |
zip(byte[] b)
compress data using ZLIB |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteUtils()
Method Detail |
---|
public static long byte3ToLong(byte[] b, int offset)
b
- byte[]offset
- int
public static long byte4ToLong(byte[] b, int offset)
b
- byte[]offset
- int
public static byte[] longToByte3(long l)
l
- long
public static byte[] longToByte4(long l)
l
- long
public static long removeZeroBits(long l)
l
- long
public static long addZeroBits(long l)
l
- long
public static byte[] zip_expand(byte[] b, long size) throws java.io.IOException
b
- byte[] data to decompress.size
- long expected uncompressed size.
java.io.IOException
public static byte[] zip(byte[] b) throws java.io.IOException
b
- byte[] data to compress
java.io.IOException
public static java.lang.String byteToString(byte b)
public static byte[] unsync(byte[] data)
public static byte[] sync(byte[] data)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |