com.monica.javacom.util
Class MJCConverter

java.lang.Object
  |
  +--com.monica.javacom.util.MJCConverter

public class MJCConverter
extends java.lang.Object

Class for implementing byte-char conversions as all the other classes assume, but not all JAVA VMs do. Currently (as we have till now experienced) we have a phenomenon which only occures under the Windows platform. This (for us) not wanted behaviour can be tested.


Constructor Summary
MJCConverter()
          Public constructor.
 
Method Summary
 byte[] getBytes(java.lang.String s)
          Converts a String to a byte array.
 boolean isWindows()
          Are we running under Windows?
 java.lang.String toString(byte[] b)
          Converts a byte array to a String.
 java.lang.String toString(byte[] b, int l)
          Converts the first l bytes of a byte array to String.
 java.lang.String toString(byte[] b, int off, int len)
          Converts len bytes beginning at offset off from a byte array to String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCConverter

public MJCConverter()
Public constructor.
Method Detail

toString

public java.lang.String toString(byte[] b)
Converts a byte array to a String.
Parameters:
byte - b[]: the byte array to be converted to String
Returns:
String: the String from the byte array

toString

public java.lang.String toString(byte[] b,
                                 int l)
Converts the first l bytes of a byte array to String.
Parameters:
byte - b[]: the byte array to be converted to String
int - l: the first l bytes will be converted
Returns:
String: the resulting String

toString

public java.lang.String toString(byte[] b,
                                 int off,
                                 int len)
Converts len bytes beginning at offset off from a byte array to String. Indexes i, off<=i<(off+len) will be converted.
Parameters:
byte - b[] the byte array to be converted
int - off: the starting offset
int - len: how many bytes will be converted
Returns:
String: the resulting String

getBytes

public byte[] getBytes(java.lang.String s)
Converts a String to a byte array.
Parameters:
String - s: the string to be converted to byte array
Returns:
byte[]: the resulting byte array

isWindows

public boolean isWindows()
Are we running under Windows?
Returns:
boolean: true if Windows has been detected