org.apache.poi.util
Class StringUtil

java.lang.Object
  |
  +--org.apache.poi.util.StringUtil

public class StringUtil
extends java.lang.Object

Title: String Utility Description: Collection of string handling utilities * * Now it is quite confusing: the method pairs, in which * one of them write data and other read written data are: * putUncompressedUnicodeHigh and getFromUnicode * putUncompressedUnicode and getFromUnicodeHigh * *@author Andrew C. Oliver *@author Sergei Kozello (sergeikozello at mail.ru) *@created May 10, 2002 *@version 1.0


Method Summary
static java.lang.String format(java.lang.String message, java.lang.Object[] params)
          Description of the Method * *@param message Description of the Parameter *@param params Description of the Parameter *@return Description of the Return Value
static java.lang.String getFromCompressedUnicode(byte[] string, int offset, int len)
          read compressed unicode(8bit) * * @author Toshiaki Kamoshida(kamoshida.toshiaki at future dot co dot jp) * * @param string byte array to read * @param offset offset to read byte array * @param len length to read byte array * @return String generated String instance by reading byte array
static java.lang.String getFromUnicode(byte[] string)
          given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x00, 0x16 } -> 0x16 * *@param string the byte array to be converted *@return the converted string
static java.lang.String getFromUnicode(byte[] string, int offset, int len)
          given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x00, 0x16 } -> 0x16 * *@param string the byte array to be converted *@param offset the initial offset into the * byte array.
static java.lang.String getFromUnicodeHigh(byte[] string)
          given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x16, 0x00 } -> 0x16 * *@param string the byte array to be converted *@return the converted string
static java.lang.String getFromUnicodeHigh(byte[] string, int offset, int len)
          given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x16, 0x00 } -> 0x16 * *@param string the byte array to be converted *@param offset the initial offset into the * byte array.
static java.lang.String getPreferredEncoding()
           
static void putCompressedUnicode(java.lang.String input, byte[] output, int offset)
          write compressed unicode * *@param input the String containing the data to be written *@param output the byte array to which the data is to be written *@param offset an offset into the byte arrat at which the data is start * when written
static void putUncompressedUnicode(java.lang.String input, byte[] output, int offset)
          Write uncompressed unicode * *@param input the String containing the unicode data to be written *@param output the byte array to hold the uncompressed unicode *@param offset the offset to start writing into the byte array
static void putUncompressedUnicodeHigh(java.lang.String input, byte[] output, int offset)
          Write uncompressed unicode * *@param input the String containing the unicode data to be written *@param output the byte array to hold the uncompressed unicode *@param offset the offset to start writing into the byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFromUnicodeHigh

public static java.lang.String getFromUnicodeHigh(byte[] string,
                                                  int offset,
                                                  int len)
                                           throws java.lang.ArrayIndexOutOfBoundsException,
                                                  java.lang.IllegalArgumentException
given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x16, 0x00 } -> 0x16 * *@param string the byte array to be converted *@param offset the initial offset into the * byte array. it is assumed that string[ offset ] and string[ offset + * 1 ] contain the first 16-bit unicode character *@param len *@return the converted string *@exception ArrayIndexOutOfBoundsException if offset is out of bounds for * the byte array (i.e., is negative or is greater than or equal to * string.length) *@exception IllegalArgumentException if len is too large (i.e., * there is not enough data in string to create a String of that * length) *@len the length of the final string

java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalArgumentException

getFromUnicodeHigh

public static java.lang.String getFromUnicodeHigh(byte[] string)
given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x16, 0x00 } -> 0x16 * *@param string the byte array to be converted *@return the converted string


getFromUnicode

public static java.lang.String getFromUnicode(byte[] string,
                                              int offset,
                                              int len)
                                       throws java.lang.ArrayIndexOutOfBoundsException,
                                              java.lang.IllegalArgumentException
given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x00, 0x16 } -> 0x16 * *@param string the byte array to be converted *@param offset the initial offset into the * byte array. it is assumed that string[ offset ] and string[ offset + * 1 ] contain the first 16-bit unicode character *@param len *@return the converted string *@exception ArrayIndexOutOfBoundsException if offset is out of bounds for * the byte array (i.e., is negative or is greater than or equal to * string.length) *@exception IllegalArgumentException if len is too large (i.e., * there is not enough data in string to create a String of that * length) *@len the length of the final string

java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalArgumentException

getFromUnicode

public static java.lang.String getFromUnicode(byte[] string)
given a byte array of 16-bit unicode characters, compress to 8-bit and * return a string * * { 0x00, 0x16 } -> 0x16 * *@param string the byte array to be converted *@return the converted string


getFromCompressedUnicode

public static java.lang.String getFromCompressedUnicode(byte[] string,
                                                        int offset,
                                                        int len)
read compressed unicode(8bit) * * @author Toshiaki Kamoshida(kamoshida.toshiaki at future dot co dot jp) * * @param string byte array to read * @param offset offset to read byte array * @param len length to read byte array * @return String generated String instance by reading byte array


putCompressedUnicode

public static void putCompressedUnicode(java.lang.String input,
                                        byte[] output,
                                        int offset)
write compressed unicode * *@param input the String containing the data to be written *@param output the byte array to which the data is to be written *@param offset an offset into the byte arrat at which the data is start * when written


putUncompressedUnicode

public static void putUncompressedUnicode(java.lang.String input,
                                          byte[] output,
                                          int offset)
Write uncompressed unicode * *@param input the String containing the unicode data to be written *@param output the byte array to hold the uncompressed unicode *@param offset the offset to start writing into the byte array


putUncompressedUnicodeHigh

public static void putUncompressedUnicodeHigh(java.lang.String input,
                                              byte[] output,
                                              int offset)
Write uncompressed unicode * *@param input the String containing the unicode data to be written *@param output the byte array to hold the uncompressed unicode *@param offset the offset to start writing into the byte array


format

public static java.lang.String format(java.lang.String message,
                                      java.lang.Object[] params)
Description of the Method * *@param message Description of the Parameter *@param params Description of the Parameter *@return Description of the Return Value


getPreferredEncoding

public static java.lang.String getPreferredEncoding()
Returns:
the encoding we want to use (ISO-8859-1)


Copyright © 2003 Apache Software Foundation.