Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Version:
  1.0
Author:
  Andrew C. Oliver, Sergei Kozello (sergeikozello at mail.ru)

Method Summary
`static java.lang.String` | `format(java.lang.String message, java.lang.Object[] params)` Description of the Method
`static java.lang.String` | `getFromCompressedUnicode(byte[] string, int offset, int len)` read compressed unicode(8bit)
`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
`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
`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
`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
`static java.lang.String` | `getPreferredEncoding()`
`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
`static void` | `putUncompressedUnicodeHigh(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

### 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

  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)

### 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

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

  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 { 0x00, 0x16 } -> 0x16

  Parameters:
    `string` - the byte array to be converted
  Returns:
    the converted string

### getFromCompressedUnicode

    public static java.lang.String getFromCompressedUnicode(byte[] string,
                                                            int offset,
                                                            int len)

  read compressed unicode(8bit)

  Parameters:
    `string` - byte array to read
    `offset` - offset to read byte array
    `len` - length to read byte array
  Returns:
    String generated String instance by reading byte array

### 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

### putUncompressedUnicodeHigh

    public static void putUncompressedUnicodeHigh(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)

  Description of the Method

  Parameters:
    `message` - Description of the Parameter
    `params` - Description of the Parameter
  Returns:
    Description of the Return Value

### getPreferredEncoding

    public static java.lang.String getPreferredEncoding()

  Returns:
    the encoding we want to use (ISO-8859-1)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 Apache Software Foundation.