|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.myjavatools.lib.Bytes
public abstract class Bytes
Constructor Summary | |
---|---|
Bytes()
|
Method Summary | |
---|---|
static long |
crc32(byte[] data)
Calculates crc32 on a byte array |
static long |
crc32(byte[] data,
int off,
int len)
Calculates crc32 on a byte array |
static byte[] |
toBytes(char[] from)
Converts char array to byte array (per-element casting) |
static byte[] |
toBytes(long from)
Converts long to byte array (lower bytes first) |
static char[] |
toChars(byte[] from)
Converts byte array to char array (per-element casting) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bytes()
Method Detail |
---|
public static final byte[] toBytes(char[] from)
from
- char array
toBytes(new char[] {0x0123, 0x4567, 0x89ab, 0xcdef})
returns {0x23, 0x67, (byte)0xab, (byte)0xef}.public static final char[] toChars(byte[] from)
from
- byte array
toChars(new byte[] {0x23, 0x67, (byte)0xab, (byte)0xef})
returns new char[] {0x23, 0x67, 0xab, 0xef}.public static final long crc32(byte[] data)
data
- source bytes
crc32(new byte[] {1, 2, 3})
returns 1438416925.public static final long crc32(byte[] data, int off, int len)
data
- source bytesoff
- offset in the arraylen
- length of the area to crc
crc32(new byte[] {0, 1, 2, 3, 4}, 1, 3)
returns 1438416925.public static final byte[] toBytes(long from)
from
- the long value
toBytes(0x0123456789abcdefl)
returns {(byte)0xef, (byte)0xcd, (byte)0xab, (byte)0x89, 0x67, 0x45, 0x23, 0x01}.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |