EAF 7.6 Implementation

com.lutris.util
Class BytesToString

java.lang.Object
  extended by com.lutris.util.BytesToString

public class BytesToString
extends java.lang.Object

This class has static methods which convert arrays of bytes to a strings. It remaps non-ascii bytes to ".". One use for this class is to convert raw data read in from a file or the net to a human-readable form, probably for debugging.

Author:
Andy John

Constructor Summary
BytesToString()
           
 
Method Summary
static java.lang.String conv(byte[] b)
          Converts the array of bytes to a string.
static java.lang.String conv(byte[] b, int len)
          Converts the array of bytes to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BytesToString

public BytesToString()
Method Detail

conv

public static java.lang.String conv(byte[] b)
Converts the array of bytes to a string. Non-ascii characters are converted to ".".

Parameters:
b - The array of bytes to convert.
Returns:
The bytes converted into a string.

conv

public static java.lang.String conv(byte[] b,
                                    int len)
Converts the array of bytes to a string. Non-ascii characters are converted to ".". Only the first len bytes are used.

Parameters:
b - The array of bytes to convert.
len - Only uses bytes b[0]..b[len-1].
Returns:
The bytes converted into a string.

EAF 7.6 Implementation