StringUtil javadocs, supplied by Nick Burch, thanks. bug 34922
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353681 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3dfeef4a30
commit
a3c885ca46
@ -39,8 +39,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* given a byte array of 16-bit unicode characters, compress to 8-bit and
|
* Given a byte array of 16-bit unicode characters in Little Endian
|
||||||
* return a string
|
* format (most important byte last), return a Java String representation
|
||||||
|
* of it.
|
||||||
*
|
*
|
||||||
* { 0x16, 0x00 } -0x16
|
* { 0x16, 0x00 } -0x16
|
||||||
*
|
*
|
||||||
@ -77,8 +78,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* given a byte array of 16-bit unicode characters, compress to 8-bit and
|
* Given a byte array of 16-bit unicode characters in little endian
|
||||||
* return a string
|
* format (most important byte last), return a Java String representation
|
||||||
|
* of it.
|
||||||
*
|
*
|
||||||
* { 0x16, 0x00 } -0x16
|
* { 0x16, 0x00 } -0x16
|
||||||
*
|
*
|
||||||
@ -90,8 +92,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* given a byte array of 16-bit unicode characters, compress to 8-bit and
|
* Given a byte array of 16-bit unicode characters in big endian
|
||||||
* return a string
|
* format (most important byte first), return a Java String representation
|
||||||
|
* of it.
|
||||||
*
|
*
|
||||||
* { 0x00, 0x16 } -0x16
|
* { 0x00, 0x16 } -0x16
|
||||||
*
|
*
|
||||||
@ -127,8 +130,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* given a byte array of 16-bit unicode characters, compress to 8-bit and
|
* Given a byte array of 16-bit unicode characters in big endian
|
||||||
* return a string
|
* format (most important byte first), return a Java String representation
|
||||||
|
* of it.
|
||||||
*
|
*
|
||||||
* { 0x00, 0x16 } -0x16
|
* { 0x00, 0x16 } -0x16
|
||||||
*
|
*
|
||||||
@ -140,7 +144,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read compressed unicode(8bit)
|
* Read 8 bit data (in ISO-8859-1 codepage) into a (unicode) Java
|
||||||
|
* String and return.
|
||||||
|
* (In Excel terms, read compressed 8 bit unicode as a string)
|
||||||
*
|
*
|
||||||
* @param string byte array to read
|
* @param string byte array to read
|
||||||
* @param offset offset to read byte array
|
* @param offset offset to read byte array
|
||||||
@ -159,7 +165,9 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* write compressed unicode
|
* Takes a unicode (java) string, and returns it as 8 bit data (in ISO-8859-1
|
||||||
|
* codepage).
|
||||||
|
* (In Excel terms, write compressed 8 bit unicode)
|
||||||
*
|
*
|
||||||
*@param input the String containing the data to be written
|
*@param input the String containing the data to be written
|
||||||
*@param output the byte array to which the data is to be written
|
*@param output the byte array to which the data is to be written
|
||||||
@ -179,10 +187,12 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write uncompressed unicode
|
* Takes a unicode string, and returns it as little endian (most
|
||||||
|
* important byte last) bytes in the supplied byte array.
|
||||||
|
* (In Excel terms, write uncompressed unicode)
|
||||||
*
|
*
|
||||||
*@param input the String containing the unicode data to be written
|
*@param input the String containing the unicode data to be written
|
||||||
*@param output the byte array to hold the uncompressed unicode
|
*@param output the byte array to hold the uncompressed unicode, should be twice the length of the String
|
||||||
*@param offset the offset to start writing into the byte array
|
*@param offset the offset to start writing into the byte array
|
||||||
*/
|
*/
|
||||||
public static void putUnicodeLE(
|
public static void putUnicodeLE(
|
||||||
@ -198,10 +208,12 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write uncompressed unicode
|
* Takes a unicode string, and returns it as big endian (most
|
||||||
|
* important byte first) bytes in the supplied byte array.
|
||||||
|
* (In Excel terms, write uncompressed unicode)
|
||||||
*
|
*
|
||||||
*@param input the String containing the unicode data to be written
|
*@param input the String containing the unicode data to be written
|
||||||
*@param output the byte array to hold the uncompressed unicode
|
*@param output the byte array to hold the uncompressed unicode, should be twice the length of the String
|
||||||
*@param offset the offset to start writing into the byte array
|
*@param offset the offset to start writing into the byte array
|
||||||
*/
|
*/
|
||||||
public static void putUnicodeBE(
|
public static void putUnicodeBE(
|
||||||
@ -217,11 +229,12 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the Method
|
* Apply printf() like formatting to a string.
|
||||||
*
|
* Primarily used for logging.
|
||||||
*@param message Description of the Parameter
|
*@param message the string with embedded formatting info
|
||||||
*@param params Description of the Parameter
|
* eg. "This is a test %2.2"
|
||||||
*@return Description of the Return Value
|
*@param params array of values to format into the string
|
||||||
|
*@return The formatted string
|
||||||
*/
|
*/
|
||||||
public static String format(String message, Object[] params) {
|
public static String format(String message, Object[] params) {
|
||||||
int currentParamNumber = 0;
|
int currentParamNumber = 0;
|
||||||
@ -256,14 +269,7 @@ public class StringUtil {
|
|||||||
return formattedMessage.toString();
|
return formattedMessage.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of the Method
|
|
||||||
*
|
|
||||||
*@param number Description of the Parameter
|
|
||||||
*@param formatting Description of the Parameter
|
|
||||||
*@param outputTo Description of the Parameter
|
|
||||||
*@return Description of the Return Value
|
|
||||||
*/
|
|
||||||
private static int matchOptionalFormatting(
|
private static int matchOptionalFormatting(
|
||||||
Number number,
|
Number number,
|
||||||
String formatting,
|
String formatting,
|
||||||
@ -298,7 +304,7 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the encoding we want to use (ISO-8859-1)
|
* @return the encoding we want to use, currently hardcoded to ISO-8859-1
|
||||||
*/
|
*/
|
||||||
public static String getPreferredEncoding() {
|
public static String getPreferredEncoding() {
|
||||||
return ENCODING;
|
return ENCODING;
|
||||||
@ -321,7 +327,8 @@ public class StringUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param format
|
* Checks to see if a given String needs to be represented as Unicode
|
||||||
|
* @param value
|
||||||
* @return true if string needs Unicode to be represented.
|
* @return true if string needs Unicode to be represented.
|
||||||
*/
|
*/
|
||||||
public static boolean isUnicodeString(final String value) {
|
public static boolean isUnicodeString(final String value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user