jxl.biff
Class StringHelper

java.lang.Object
  extended byjxl.biff.StringHelper

public final class StringHelper
extends java.lang.Object

Helper function to convert Java string objects to and from the byte representations


Method Summary
static byte[] getBytes(java.lang.String s)
          Deprecated.  
static void getBytes(java.lang.String s, byte[] d, int pos)
          Gets the ASCII bytes from the specified string and places them in the array at the specified position
static byte[] getBytes(java.lang.String s, WorkbookSettings ws)
          Gets the bytes of the specified string.
static java.lang.String getString(byte[] d, int length, int pos, WorkbookSettings ws)
          Gets a string from the data array using the character encoding for this workbook
static byte[] getUnicodeBytes(java.lang.String s)
          Converts the string into a little-endian array of Unicode bytes
static void getUnicodeBytes(java.lang.String s, byte[] d, int pos)
          Inserts the unicode byte representation of the specified string into the array passed in
static java.lang.String getUnicodeString(byte[] d, int length, int pos)
          Gets a string from the data array
static java.lang.String replace(java.lang.String input, java.lang.String search, java.lang.String replace)
          Replaces all instances of search with replace in the input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBytes

public static byte[] getBytes(java.lang.String s)
Deprecated.  

Gets the bytes of the specified string. This will simply return the ASCII values of the characters in the string

Parameters:
s - the string to convert into bytes
Returns:
the ASCII values of the characters in the string

getBytes

public static byte[] getBytes(java.lang.String s,
                              WorkbookSettings ws)
Gets the bytes of the specified string. This will simply return the ASCII values of the characters in the string

Parameters:
s - the string to convert into bytes
Returns:
the ASCII values of the characters in the string

getUnicodeBytes

public static byte[] getUnicodeBytes(java.lang.String s)
Converts the string into a little-endian array of Unicode bytes

Parameters:
s - the string to convert
Returns:
the unicode values of the characters in the string

getBytes

public static void getBytes(java.lang.String s,
                            byte[] d,
                            int pos)
Gets the ASCII bytes from the specified string and places them in the array at the specified position

Parameters:
pos - the position at which to place the converted data
s - the string to convert
d - the byte array which will contain the converted string data

getUnicodeBytes

public static void getUnicodeBytes(java.lang.String s,
                                   byte[] d,
                                   int pos)
Inserts the unicode byte representation of the specified string into the array passed in

Parameters:
pos - the position at which to insert the converted data
s - the string to convert
d - the byte array which will hold the string data

getString

public static java.lang.String getString(byte[] d,
                                         int length,
                                         int pos,
                                         WorkbookSettings ws)
Gets a string from the data array using the character encoding for this workbook

Parameters:
pos - The start position of the string
length - The number of characters in the string
d - The byte data
ws - the workbook settings
Returns:
the string built up from the raw bytes

getUnicodeString

public static java.lang.String getUnicodeString(byte[] d,
                                                int length,
                                                int pos)
Gets a string from the data array

Parameters:
pos - The start position of the string
length - The number of characters in the string
d - The byte data
Returns:
the string built up from the unicode characters

replace

public static final java.lang.String replace(java.lang.String input,
                                             java.lang.String search,
                                             java.lang.String replace)
Replaces all instances of search with replace in the input. Even though later versions of java can use string.replace() this is included Java 1.2 compatibility

Parameters:
input - the format string
search - the Excel character to be replaced
replace - the java equivalent
Returns:
the input string with the specified substring replaced