facets.util
Class ByteStrings

java.lang.Object
  extended by facets.util.ByteStrings

public final class ByteStrings
extends java.lang.Object

Encoding of byte[]s as ASCII text.

Currently implemented with simple hex-encoding; compactness can be improved by chaining with PackedSerialized.


Constructor Summary
ByteStrings()
           
 
Method Summary
static byte[] decodeString(java.lang.String in)
          Decodes a string created with encodeBytes(byte[]).
static java.lang.String encodeBytes(byte[] in)
          Encodes bytes as ASCII text decodable by decodeString(String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteStrings

public ByteStrings()
Method Detail

encodeBytes

public static java.lang.String encodeBytes(byte[] in)
Encodes bytes as ASCII text decodable by decodeString(String).

Parameters:
in - the bytes to encode
Returns:
the encoded string or null if an error occurred when checking the encoding.

decodeString

public static byte[] decodeString(java.lang.String in)
Decodes a string created with encodeBytes(byte[]).

Parameters:
in - the encoded string, which may contain formatting whitespace
Returns:
the decoded bytes or null if decoding fails for any reason