|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.acorn.util.converter.Bytes
public abstract class Bytes
Converts between bytes and other types.
| Field Summary | |
|---|---|
static String |
XML_AMP
XML reference for &. |
static String |
XML_APOS
XML reference for '. |
static String |
XML_EURO
XML reference for €. |
static String |
XML_GT
XML reference for >. |
static String |
XML_LT
XML reference for <. |
static String |
XML_QUOT
XML reference for ". |
static String |
XML_XAPOS
XML hex reference for '. |
static String |
XML_XQUOT
XML hex reference for ". |
| Constructor Summary | |
|---|---|
Bytes()
|
|
| Method Summary | |
|---|---|
static String |
escape(CharSequence seq)
Converts the specified sequence to an escaped string. |
static String |
fromXML(Object object)
Converts the specified XML encoded object to a text string. |
static byte[] |
hexToBytes(String digits)
Converts a string of hexadecimal digits into the corresponding byte array by encoding each two hexadecimal digits as a byte. |
static int |
hexToInt(byte[] hex)
Converts hex digits to an int. |
static long |
hexToLong(byte[] hex)
Converts hex digits to a long. |
static short |
hexToShort(byte[] hex)
Converts hex digits to a short. |
static int |
to7Bytes(String p,
byte[] bb,
int off)
Converts a 7 bit string. |
static int |
toBytes(byte[] p,
byte[] bb,
int off)
Converts a byte array. |
static int |
toBytes(byte[] p,
int s,
int l,
byte[] bb,
int off)
Converts a byte array. |
static int |
toBytes(byte p,
byte[] bb,
int off)
Converts a byte. |
static byte[] |
toBytes(char[] p,
int mask)
Converts a char array to a null terminated byte array. |
static int |
toBytes(char[] p,
int mask,
byte[] bb,
int off)
Converts a char array up to eight bits. |
static int |
toBytes(char p,
int mask,
byte[] bb,
int off)
Converts a char up to eight bits. |
static int |
toBytes(double[] p,
byte[] bb,
int off)
Converts a double array. |
static int |
toBytes(double p,
byte[] bb,
int off)
Converts a double according to IEEE 754. |
static int |
toBytes(float[] p,
byte[] bb,
int off)
Converts a float array. |
static int |
toBytes(float p,
byte[] bb,
int off)
Converts a float according to IEEE 754. |
static int |
toBytes(int[] p,
byte[] bb,
int off)
Converts an int array. |
static int |
toBytes(int p,
byte[] bb,
int off)
Converts an int. |
static int |
toBytes(long[] p,
byte[] bb,
int off)
Converts a long array. |
static int |
toBytes(long p,
byte[] bb,
int off)
Converts a long. |
static int |
toBytes(short[] p,
byte[] bb,
int off)
Converts a short array. |
static int |
toBytes(short p,
byte[] bb,
int off)
Converts a short. |
static byte[] |
toBytes(String p)
Converts an 8 bit string to a null terminated byte array. |
static int |
toBytes(String p,
byte[] bb,
int off)
Converts an 8 bit string. |
static double |
toDouble(byte[] bb,
int off)
Converts eight bytes into a double according to IEEE 754. |
static float |
toFloat(byte[] bb,
int off)
Converts four bytes into a float according to IEEE 754. |
static String |
toHex(byte b)
Converts a byte into a hex string of two chars. |
static String |
toHex(byte[] bytes)
Converts a byte array into a printable format containing a string of hexadecimal digit characters (two per byte). |
static String |
toHex(byte[] bytes,
int off,
int len)
Converts a part of a byte array into a printable format containing a string of hexadecimal digit characters (two per byte). |
static String |
toHex(char c)
Converts a char into a hex string of four chars. |
static int |
toInt(byte[] bb,
int off)
Converts four bytes into an int (BE). |
static int |
toInt(byte[] bb,
int off,
int len)
Converts a number of bytes into an int (BE). |
static int |
toIntBE(byte[] bb,
int off)
Converts four bytes into an int (BE). |
static int |
toIntBE(byte[] bb,
int off,
int len)
Converts a number of bytes into an int (BE). |
static int |
toIntLE(byte[] bb,
int off)
Converts four bytes into an int (LE). |
static int |
toIntLE(byte[] bb,
int off,
int len)
Converts a number of bytes into an int (LE). |
static long |
toLong(byte[] bb,
int off)
Converts eight bytes into a long (LE). |
static long |
toLongBE(byte[] bb,
int off)
Converts eight bytes into a long (BE). |
static long |
toLongLE(byte[] bb,
int off)
Converts eight bytes into a long (LE). |
static String |
toName(Object object)
Converts the specified string to a valid id or name attribute. |
static short |
toShort(byte[] bb,
int off)
Converts two bytes into a short (BE). |
static short |
toShortBE(byte[] bb,
int off)
Converts two bytes into a short (BE). |
static short |
toShortLE(byte[] bb,
int off)
Converts two bytes into a short (LE). |
static String |
toString(byte[] bb)
Converts bytes to string by applying platform's default encoding. |
static String |
toString(byte[] bb,
String encoding)
Converts bytes to string by applying the given encoding. |
static String |
toXML(Object object)
Converts the specified object to an XML encoded string. |
static String |
unescape(CharSequence seq)
Converts the specified sequence to an unescaped string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String XML_LT
public static final String XML_GT
public static final String XML_AMP
public static final String XML_QUOT
public static final String XML_XQUOT
public static final String XML_APOS
public static final String XML_XAPOS
public static final String XML_EURO
| Constructor Detail |
|---|
public Bytes()
| Method Detail |
|---|
public static final int toBytes(byte p,
byte[] bb,
int off)
p - the byte.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(short p,
byte[] bb,
int off)
p - the short.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(int p,
byte[] bb,
int off)
p - the int.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(long p,
byte[] bb,
int off)
p - the long.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(float p,
byte[] bb,
int off)
p - the float.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(double p,
byte[] bb,
int off)
p - the double.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(byte[] p,
byte[] bb,
int off)
p - the byte array.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(byte[] p,
int s,
int l,
byte[] bb,
int off)
p - the byte array.s - the start offset.l - the length to copy.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(short[] p,
byte[] bb,
int off)
p - the short array.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(int[] p,
byte[] bb,
int off)
p - the int array.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(long[] p,
byte[] bb,
int off)
p - the long array.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(float[] p,
byte[] bb,
int off)
p - the float array.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(double[] p,
byte[] bb,
int off)
p - the double array.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(char p,
int mask,
byte[] bb,
int off)
p - the char.mask - a byte mask.bb - the byte buffer.off - the offset in the buffer.
public static final int toBytes(char[] p,
int mask,
byte[] bb,
int off)
p - the char array.mask - a byte mask.bb - the byte buffer.off - the offset in the buffer.
public static final byte[] toBytes(char[] p,
int mask)
p - the char array.mask - a byte mask.
public static final int toBytes(String p,
byte[] bb,
int off)
p - the string.bb - the byte buffer.off - the offset in the buffer.
public static final byte[] toBytes(String p)
p - the string.
public static final int to7Bytes(String p,
byte[] bb,
int off)
p - the string.bb - the byte buffer.off - the offset in the buffer.
IllegalArgumentException - if encoding not supported.public static final String toString(byte[] bb)
bb - the byte buffer.
public static final String toString(byte[] bb,
String encoding)
bb - the byte buffer.encoding - the encoding.
public static final short toShort(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final short toShortBE(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final short toShortLE(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final int toInt(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final int toIntBE(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final int toIntLE(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final long toLong(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final long toLongBE(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final long toLongLE(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final int toInt(byte[] bb,
int off,
int len)
bb - the byte buffer.off - the offset in the buffer.len - the number of bytes.
public static final int toIntBE(byte[] bb,
int off,
int len)
bb - the byte buffer.off - the offset in the buffer.len - the number of bytes.
public static final int toIntLE(byte[] bb,
int off,
int len)
bb - the byte buffer.off - the offset in the buffer.len - the number of bytes.
public static final float toFloat(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final double toDouble(byte[] bb,
int off)
bb - the byte buffer.off - the offset in the buffer.
public static final String toHex(byte b)
b - the byte.
public static final String toHex(char c)
c - the char.
public static String toHex(byte[] bytes)
bytes - a byte array representation.
public static String toHex(byte[] bytes,
int off,
int len)
bytes - a byte array representation.off - an offset from which to start the conversion.len - the number of bytes to convert.
public static byte[] hexToBytes(String digits)
digits - hexadecimal digits representation.
IllegalArgumentException - for invalid hexadecimal digits.public static short hexToShort(byte[] hex)
hex - a byte array containing hexadecimal digits.
IllegalArgumentException - for invalid hexadecimal digits.public static int hexToInt(byte[] hex)
hex - a byte array containing hexadecimal digits.
IllegalArgumentException - for invalid hexadecimal digits.public static long hexToLong(byte[] hex)
hex - a byte array containing hexadecimal digits.
IllegalArgumentException - for invalid hexadecimal digits.public static String toXML(Object object)
object - the object to convert.
public static String fromXML(Object object)
object - the object to convert.
public static String toName(Object object)
object - the object to convert.
public static String escape(CharSequence seq)
seq - the sequence to convert.
public static String unescape(CharSequence seq)
seq - the sequence to convert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||