com.xmlmind.util
Class Base16

java.lang.Object
  extended by com.xmlmind.util.Base16

public final class Base16
extends java.lang.Object

Base-16 encoder/decoder.


Method Summary
static byte[] decode(java.lang.String s)
          Decodes base-16 encoded string.
static byte[] decode(java.lang.String s, int limit)
          Same as decode(String), except that argument limt allows to limit the number of decoded bytes.
static java.lang.String encode(byte[] b)
          Encodes binary data to base-16.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

decode

public static byte[] decode(java.lang.String s)
Decodes base-16 encoded string.

Parameters:
s - base-16 string to be decoded
Returns:
decoded binary data or null if string cannot be decoded.

decode

public static byte[] decode(java.lang.String s,
                            int limit)
Same as decode(String), except that argument limt allows to limit the number of decoded bytes. This is useful, for example, to detect the format of a base-16 encoded image based on its magic string.


encode

public static java.lang.String encode(byte[] b)
Encodes binary data to base-16.

Parameters:
b - binary data to be encoded
Returns:
base-16 encoded string