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

Version:
1.0
Author:
Andrew C. Oliver

Method Summary
static java.lang.String format(java.lang.String message, java.lang.Object[] params)
           
static java.lang.String getFromUnicode(byte[] string)
          given a byte array of 16-bit unicode characters, compress to 8-bit and return a 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
static void putCompressedUnicode(java.lang.String input, byte[] output, int offset)
          write compressed unicode
static void putUncompressedUnicode(java.lang.String input, byte[] output, int offset)
          Write uncompressed unicode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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
Parameters:
string - the byte array to be converted
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
len -  
Returns:
the converted string
Throws:
java.lang.ArrayIndexOutOfBoundsException - if offset is out of bounds for the byte array (i.e., is negative or is greater than or equal to string.length)
java.lang.IllegalArgumentException - if len is too large (i.e., there is not enough data in string to create a String of that length)

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
Parameters:
string - the byte array to be converted
Returns:
the converted string

putCompressedUnicode

public static void putCompressedUnicode(java.lang.String input,
                                        byte[] output,
                                        int offset)
write compressed unicode
Parameters:
input - the String containing the data to be written
output - the byte array to which the data is to be written
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
Parameters:
input - the String containing the unicode data to be written
output - the byte array to hold the uncompressed unicode
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)


Copyright © 2002 Apache jakarta-poi project. All Rights Reserved.