|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.silentsoftware.core.helpers.ByteHelper
public final class ByteHelper
Byte and BitSet manipulation and conversion class Disclaimer: I understand bytes and bits, but my manipulation of them is shockingly bad so I wrote this class to help me with the high level Java objects.
| Constructor Summary | |
|---|---|
private |
ByteHelper()
Private constructor since we want static use only |
| Method Summary | |
|---|---|
static byte[] |
bitSetToBytes(java.util.BitSet bs)
Copy a BitSet to a byte array |
static java.util.BitSet |
copyBits(java.util.BitSet source,
java.util.BitSet dest,
int fromIndex)
Copy bits completely from a source BitSet to a destination BitSet starting at the destination index |
static byte[] |
copyBytes(byte[] from,
byte[] to,
int fromIndex)
Copy bytes completely from a source byte array to a destination byte array starting at the destination index |
static byte |
getChecksum(byte[] result)
Implementation of an XOR checksum |
static void |
put(java.nio.ByteBuffer bb,
byte[] bytes,
int from)
The missing method on a ByteBuffer - allows copying of multiple bytes into the buffer. |
static java.util.BitSet |
reverseBitSet(java.util.BitSet bs)
Noddy method to reverse a BitSet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private ByteHelper()
| Method Detail |
|---|
public static java.util.BitSet reverseBitSet(java.util.BitSet bs)
bs -
public static byte[] bitSetToBytes(java.util.BitSet bs)
bs -
public static java.util.BitSet copyBits(java.util.BitSet source,
java.util.BitSet dest,
int fromIndex)
source - dest - fromIndex -
public static byte[] copyBytes(byte[] from,
byte[] to,
int fromIndex)
from - to - fromIndex -
public static void put(java.nio.ByteBuffer bb,
byte[] bytes,
int from)
bb - bytes - from - public static byte getChecksum(byte[] result)
result -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||