|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gregoire.util.HexUtil
Number in hexadecimal format are used throughout Freenet.
Unless otherwise stated, the conventions follow the rules outlined in the Java Language Specification.
Method Summary | |
static byte[] |
bitsToBytes(java.util.BitSet ba,
int size)
Pack the bits in ba into a byte[]. |
static java.lang.String |
bitsToHexString(java.util.BitSet ba,
int size)
Pack the bits in ba into a byte[] then convert that to a hex string and return it. |
static void |
bytesToBits(byte[] b,
java.util.BitSet ba,
int maxSize)
Read bits from a byte array into a bitset |
static java.lang.String |
bytesToHex(byte[] bs)
|
static java.lang.String |
bytesToHex(byte[] bs,
int off,
int length)
Converts a byte array into a string of upper case hex chars. |
static void |
bytesToHexAppend(byte[] bs,
int off,
int length,
java.lang.StringBuffer sb)
|
static int |
countBytesForBits(int size)
|
static void |
hexToBits(java.lang.String s,
java.util.BitSet ba,
int length)
Read a hex string of bits and write it into a bitset |
static byte[] |
hexToBytes(java.lang.String s)
|
static void |
hexToBytes(java.lang.String s,
byte[] out,
int off)
Converts a String of hex characters into an array of bytes. |
static byte[] |
hexToBytes(java.lang.String s,
int off)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static final java.lang.String bytesToHex(byte[] bs, int off, int length)
bs
- A byte arrayoff
- The index of the first byte to readlength
- The number of bytes to read.
public static final void bytesToHexAppend(byte[] bs, int off, int length, java.lang.StringBuffer sb)
public static final java.lang.String bytesToHex(byte[] bs)
public static final byte[] hexToBytes(java.lang.String s)
public static final byte[] hexToBytes(java.lang.String s, int off)
public static final void hexToBytes(java.lang.String s, byte[] out, int off) throws java.lang.NumberFormatException, java.lang.IndexOutOfBoundsException
s
- A string of hex characters (upper case or lower) of even
length.out
- A byte array of length at least s.length()/2 + offoff
- The first byte to write of the array
java.lang.NumberFormatException
java.lang.IndexOutOfBoundsException
public static final byte[] bitsToBytes(java.util.BitSet ba, int size)
public static final java.lang.String bitsToHexString(java.util.BitSet ba, int size)
public static int countBytesForBits(int size)
public static void bytesToBits(byte[] b, java.util.BitSet ba, int maxSize)
b
- the byte[] to read fromba
- the bitset to write topublic static void hexToBits(java.lang.String s, java.util.BitSet ba, int length)
s
- hex string of the stored bitsba
- the bitset to store the bits inlength
- the maximum number of bits to store
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |