|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectants.p2p.utils.donkey.Convert
public class Convert
Provides various conversion ( e.g. str <-> hex ) utility methods.
Constructor Summary | |
---|---|
Convert()
|
Method Summary | |
---|---|
static void |
appendAsHex(java.lang.StringBuffer sb,
byte[] data)
appends a byte array values to a StringBuffer as hex digits. |
static void |
appendAsHex(java.lang.StringBuffer sb,
java.lang.Byte[] data)
appends a byte array values to a StringBuffer as hex digits. |
static void |
appendAsHex(java.lang.StringBuffer sb,
java.nio.ByteBuffer data)
appends a ByteBuffers values to a StringBuffer as hex digits. |
static java.lang.StringBuffer |
appendHexDigit(java.lang.StringBuffer sb,
byte b)
convience method to append a byte b to the given StringBuffer sb. |
static void |
bitSetToBytes(java.util.BitSet bitSet,
byte[] bytes,
int pos)
|
static byte[] |
bitSetToBytes(java.util.BitSet bitSet,
int realsize)
|
static java.lang.String |
byteArrayToIpString(byte[] barray)
|
static java.lang.String |
byteBufferToHexString(java.nio.ByteBuffer data)
converts a ByteBuffer values to a String of hex digits. |
static java.lang.String |
byteBufferToHexString(java.nio.ByteBuffer data,
int offset,
int length)
converts a ByteBuffer values to a String of hex digits. |
static java.util.BitSet |
bytesToBitset(byte[] buffer,
int pos,
int length)
|
static java.lang.String |
bytesToHexString(byte[] data)
converts a byte array values to a String of hex digits. |
static java.lang.String |
bytesToHexString(java.lang.Byte[] data)
converts a Byte array values to a String of hex digits. |
static java.lang.String |
byteToHex(byte b)
converts the byte b to its String representation. |
static int |
byteToInt(byte myByte)
converts the myByte to a int. |
static byte[] |
hexStringToBytes(java.lang.String hexString)
converts a hexString to the byte represenation, |
static byte |
hexToByte(java.lang.String hex,
int pos)
converts a hex String (like "FF0B") to byte[]. |
static byte[] |
intArrayToBytes(int[] iarray)
converts an array of ints to an array of bytes using the Convert.intToByte() method. |
static java.lang.String |
intArrayToIpString(int[] iarray)
converts the array of integers to an InternetProtocol ver. |
static byte |
intToByte(int value)
converts the given int value to byte. |
static byte[] |
ipStringToBytes(java.lang.String ipString)
converts a textual representation of an InternetProtocol (IP ) ver. |
static java.util.Locale |
parseLocale(java.lang.String localeAsStr)
|
static boolean |
stringToBoolean(java.lang.String str)
Interprets a string as boolean value. |
static long |
unsignedIntToLong(int i)
|
static int |
unsignedShortToInt(short i)
converts a unsigned short into integer. |
static int[] |
unsingedByteArrayToInts(byte[] barray)
coverts an array of unsigned bytes to an array of integers using the Convert.byteToInt(). |
static long |
unsingedByteToLong(byte b)
Interprets a byte as unsigned and cast it to long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Convert()
Method Detail |
---|
public static final byte[] ipStringToBytes(java.lang.String ipString)
public static final byte[] hexStringToBytes(java.lang.String hexString)
public static final java.lang.StringBuffer appendHexDigit(java.lang.StringBuffer sb, byte b)
public static final void appendAsHex(java.lang.StringBuffer sb, byte[] data)
public static final void appendAsHex(java.lang.StringBuffer sb, java.lang.Byte[] data)
public static final void appendAsHex(java.lang.StringBuffer sb, java.nio.ByteBuffer data)
public static final java.lang.String byteToHex(byte b)
public static final java.lang.String bytesToHexString(byte[] data)
public static final java.lang.String bytesToHexString(java.lang.Byte[] data)
public static final java.lang.String byteBufferToHexString(java.nio.ByteBuffer data)
public static final java.lang.String byteBufferToHexString(java.nio.ByteBuffer data, int offset, int length)
public static final byte hexToByte(java.lang.String hex, int pos)
public static final boolean stringToBoolean(java.lang.String str)
public static final java.util.BitSet bytesToBitset(byte[] buffer, int pos, int length)
public static final void bitSetToBytes(java.util.BitSet bitSet, byte[] bytes, int pos)
public static final byte[] bitSetToBytes(java.util.BitSet bitSet, int realsize)
bitSet
- BitSet to convertrealsize
- maximum used bits in set possibly more than bitSet.length() and less than bitSet.size().
public static final int byteToInt(byte myByte)
public static final byte intToByte(int value)
public static final byte[] intArrayToBytes(int[] iarray)
public static final int[] unsingedByteArrayToInts(byte[] barray)
public static final java.lang.String intArrayToIpString(int[] iarray)
iarray
- must be of the length = 4; all other entrys are ignored.public static final java.lang.String byteArrayToIpString(byte[] barray)
public static final long unsingedByteToLong(byte b)
b
- the unsigned byte as java byte.
public static final long unsignedIntToLong(int i)
public static final int unsignedShortToInt(short i)
public static final java.util.Locale parseLocale(java.lang.String localeAsStr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |