rebuild.util.text
Class StringUtilities

java.lang.Object
  extended by rebuild.util.text.StringUtilities

public final class StringUtilities
extends java.lang.Object

Various String utilities.

Since:
BBX 1.0.1

Field Summary
static int BASE64FORMATTINGOPTIONS_INSERTLINEBREAKS
          Inserts line breaks after every 76 characters in the string representation.
static int BASE64FORMATTINGOPTIONS_NONE
          Does not insert line breaks after every 76 characters in the string representation.
static short STRINGSPLITOPTIONS_NONE
          The return value includes array elements that contain an empty string.
static short STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES
          The return value does not include array elements that contain an empty string.
 
Method Summary
static java.lang.StringBuffer append(java.lang.StringBuffer buf, char value, int repeatCount)
          Appends a specified number of copies of the string representation of a Unicode character to the end of the StringBuffer.
static java.lang.StringBuffer append(java.lang.StringBuffer buf, char value, int repeatCount, int index)
          Appends a specified number of copies of the string representation of a Unicode character to the end of the StringBuffer.
static java.lang.StringBuffer append(java.lang.StringBuffer buf, java.lang.String value, int startIndex, int index, boolean indexIsLength)
          Appends a section of string to the specified StringBuffer.
static int compareOrdinal(java.lang.String strA, int indexA, java.lang.String strB, int indexB, int length)
          Compares substrings of two specified String objects by evaluating the numeric values of the corresponding char objects in each substring.
static int compareToLength(java.lang.String str1, java.lang.String str2, int length)
          Compare two strings up to a certain length.
static boolean contains(java.lang.String stringToCheck, java.lang.String value)
          Returns a value indicating whether the specified String object occurs within this string.
static java.lang.StringBuffer delete(java.lang.StringBuffer buf, int startingIndex, int length)
          Removes the characters in a substring of a StringBuffer.
static char forDigit(int digit, int radix)
          Get the character value for the specified numeric digit.
static java.lang.String format_java(java.lang.String format, java.lang.Object arg0)
          Format a string.
static java.lang.String format_java(java.lang.String format, java.lang.Object[] args)
          Format a string.
static java.lang.String format_java(java.lang.String format, java.lang.Object arg0, java.lang.Object arg1)
          Format a string.
static java.lang.String format_java(java.lang.String format, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
          Format a string.
static java.lang.String format_printf(java.lang.String format, java.lang.Object arg0)
          Format a string.
static java.lang.String format_printf(java.lang.String format, java.lang.Object[] args)
          Format a string.
static java.lang.String format_printf(java.lang.String format, java.lang.Object arg0, java.lang.Object arg1)
          Format a string.
static java.lang.String format_printf(java.lang.String format, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
          Format a string.
static int fprintf(java.io.OutputStream stream, java.lang.String format, java.lang.Object[] argptr)
          Write formatted output to a output stream.
static int fprintf(java.io.PrintStream stream, int count, java.lang.String format, java.lang.Object[] argptr)
          Write formatted output to a print stream.
static int fprintf(java.io.PrintStream stream, java.lang.String format, java.lang.Object[] argptr)
          Write formatted output to a print stream.
static int fprintf(Stream stream, java.lang.String format, java.lang.Object[] argptr)
          Write formatted output to a stream.
static byte[] fromBase64CharArray(char[] inArray, int offset, int length)
          Converts a subset of a Unicode character array, which encodes binary data as base 64 digits, to an equivalent 8-bit unsigned integer array.
static byte[] fromBase64String(java.lang.String s)
          Converts the specified String, which encodes binary data as base 64 digits, to an equivalent 8-bit signed integer array.
static int fscanf(java.io.InputStream file, java.lang.String format, java.lang.Object[] argptr)
          Read formatted data from a input stream.
static int fscanf(Stream file, java.lang.String format, java.lang.Object[] argptr)
          Read formatted data from a stream.
static boolean isLetterOrDigit(char ch)
          Determines if the specified character is a letter or digit.
static boolean isNullEmptyOrWhitespace(java.lang.String value)
          Indicates whether the specified String object is null, an Empty string, or whitespace.
static boolean isNullOrEmpty(java.lang.String value)
          Indicates whether the specified String object is null or an Empty string.
static int lastIndexOf(java.lang.String str, java.lang.String value)
          Returns the index within a string of the last occurrence of the specified substring.
static int printf(java.lang.String format, java.lang.Object[] argptr)
          Print formatted data to System.out
static java.lang.String replace(java.lang.String str, char oldChar, char newChar)
          Replaces all occurrences of a specified Unicode character in this instance with another specified Unicode character.
static java.lang.String replace(java.lang.String str, java.lang.String oldValue, java.lang.String newValue)
          Replaces all occurrences of a specified String in a String, with another specified String.
static java.lang.String[] split(java.lang.String str, char separator)
          Returns a String array containing the substrings in this instance that are delimited by a separator.
static java.lang.String[] split(java.lang.String str, char[] separator)
          Returns a String array containing the substrings in this instance that are delimited by elements of a specified char array.
static java.lang.String[] split(java.lang.String str, char[] separator, int count)
          Returns a String array containing the substrings in this instance that are delimited by elements of a specified char array.
static java.lang.String[] split(java.lang.String str, char[] separator, int count, short options)
          Returns a String array containing the substrings in this string that are delimited by elements of a specified char array.
static java.lang.String[] split(java.lang.String str, char[] separator, short options)
          Returns a String array containing the substrings in this string that are delimited by elements of a specified char array.
static java.lang.String[] split(java.lang.String str, java.lang.String[] separator, int count, short options)
          Returns a String array containing the substrings in this string that are delimited by elements of a specified String array.
static java.lang.String[] split(java.lang.String str, java.lang.String[] separator, short options)
          Returns a String array containing the substrings in this string that are delimited by elements of a specified String array.
static int sprintf(char[] buffer, java.lang.String format, java.lang.Object[] argptr)
          Print formatted variable argument list to a char array.
static int sprintf(java.lang.StringBuffer buffer, java.lang.String format, java.lang.Object[] argptr)
          Print formatted variable argument list to a string buffer.
static int sscanf(java.lang.String str, java.lang.String format, java.lang.Object[] argptr)
          Read formatted data from string.
static java.lang.String substring(java.lang.String str, int startIndex, int length)
          Retrieves a substring from this instance.
static int toBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut)
          Converts a subset of an 8-bit signed integer array to an equivalent subset of a Unicode character array encoded with base 64 digits.
static int toBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut, int options)
          Converts a subset of an 8-bit signed integer array to an equivalent subset of a Unicode character array encoded with base 64 digits.
static java.lang.String toBase64String(byte[] inArray)
          Converts the value of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits.
static java.lang.String toBase64String(byte[] inArray, int options)
          Converts a subset of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits.
static java.lang.String toBase64String(byte[] inArray, int offset, int length)
          Converts a subset of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits.
static java.lang.String toBase64String(byte[] inArray, int offset, int length, int options)
          Converts a subset of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits.
static char[] toCharArray(java.lang.String str, int startIndex, int length)
          Copies the characters in a specified substring in this instance to a Unicode character array.
static int vsnprintf(char[] buffer, int count, java.lang.String format, java.lang.Object[] argptr)
          Print formatted variable argument list to a char array.
static int vsnprintf(java.lang.StringBuffer buffer, int count, java.lang.String format, java.lang.Object[] argptr)
          Print formatted variable argument list to a string buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRINGSPLITOPTIONS_NONE

public static final short STRINGSPLITOPTIONS_NONE
The return value includes array elements that contain an empty string.

See Also:
Constant Field Values

STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES

public static final short STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES
The return value does not include array elements that contain an empty string.

See Also:
Constant Field Values

BASE64FORMATTINGOPTIONS_NONE

public static final int BASE64FORMATTINGOPTIONS_NONE
Does not insert line breaks after every 76 characters in the string representation.

See Also:
Constant Field Values

BASE64FORMATTINGOPTIONS_INSERTLINEBREAKS

public static final int BASE64FORMATTINGOPTIONS_INSERTLINEBREAKS
Inserts line breaks after every 76 characters in the string representation.

See Also:
Constant Field Values
Method Detail

isNullOrEmpty

public static boolean isNullOrEmpty(java.lang.String value)
Indicates whether the specified String object is null or an Empty string.

Parameters:
value - A String reference.
Returns:
true if the value parameter is null or an empty string (""); otherwise, false.

isNullEmptyOrWhitespace

public static boolean isNullEmptyOrWhitespace(java.lang.String value)
Indicates whether the specified String object is null, an Empty string, or whitespace.

Parameters:
value - A String reference.
Returns:
true if the value parameter is null, an empty string (""), or whitespace; otherwise, false.
Since:
BBX 1.1.0

contains

public static boolean contains(java.lang.String stringToCheck,
                               java.lang.String value)
Returns a value indicating whether the specified String object occurs within this string.

Parameters:
stringToCheck - The String that should be checked.
value - The String object to seek.
Returns:
true if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false.
Throws:
java.lang.NullPointerException - If value or stringToCheck is null.

toCharArray

public static char[] toCharArray(java.lang.String str,
                                 int startIndex,
                                 int length)
Copies the characters in a specified substring in this instance to a Unicode character array.

Parameters:
str - The String to get the chars from.
startIndex - The starting position of a substring in this instance.
length - The length of the substring in this instance.
Returns:
A Unicode character array whose elements are the length number of characters in this instance starting from character position startIndex.
Throws:
java.lang.StringIndexOutOfBoundsException - startIndex or length is less than zero.-or- startIndex plus length is greater than the length of this instance.

compareToLength

public static int compareToLength(java.lang.String str1,
                                  java.lang.String str2,
                                  int length)
Compare two strings up to a certain length.

Parameters:
str1 - String to compare.
str2 - String to compare.
length - How many chars to compare up to.
Returns:
The value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument.
Throws:
java.lang.NullPointerException - str1 or str2 is null.
java.lang.StringIndexOutOfBoundsException - length is less then 0 (zero).

substring

public static java.lang.String substring(java.lang.String str,
                                         int startIndex,
                                         int length)
Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.

Parameters:
str - The String to split.
startIndex - The index of the start of the substring.
length - The number of characters in the substring.
Returns:
A String equivalent to the substring of length length that begins at startIndex in this instance, or "" if startIndex is equal to the length of this instance and length is zero.
Throws:
java.lang.StringIndexOutOfBoundsException - startIndex plus length indicates a position not within this instance.-or- startIndex or length is less than zero.

replace

public static java.lang.String replace(java.lang.String str,
                                       char oldChar,
                                       char newChar)
Replaces all occurrences of a specified Unicode character in this instance with another specified Unicode character. This is exactly the same as str.replace(oldChar, newChar).

Parameters:
str - The String to replace chars from.
oldChar - A Unicode character to be replaced.
newChar - A Unicode character to replace all occurrences of oldChar.
Returns:
A String equivalent to this instance but with all instances of oldChar replaced with newChar.

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String oldValue,
                                       java.lang.String newValue)
Replaces all occurrences of a specified String in a String, with another specified String.

Parameters:
str - The String to replace something from.
oldValue - A String to be replaced.
newValue - A String to replace all occurrences of oldValue.
Returns:
A String equivalent to str but with all instances of oldValue replaced with newValue.
Throws:
java.lang.NullPointerException - oldValue or str is null.
java.lang.IllegalArgumentException - oldValue is the empty string ("").

lastIndexOf

public static int lastIndexOf(java.lang.String str,
                              java.lang.String value)
Returns the index within a string of the last occurrence of the specified substring.

Parameters:
str - The String to search in.
value - The value to search for.
Returns:
The last index of the specified value within the string, or -1 if it doesn't exist.
Since:
BBX 1.2.0

isLetterOrDigit

public static boolean isLetterOrDigit(char ch)
Determines if the specified character is a letter or digit.

Parameters:
ch - the character to be tested.
Returns:
true if the character is a letter or digit; false otherwise.
Since:
BBX 1.2.0

split

public static java.lang.String[] split(java.lang.String str,
                                       char separator)
Returns a String array containing the substrings in this instance that are delimited by a separator.

Parameters:
str - The String to split.
separator - A Unicode character that delimit the substrings in this instance.
Returns:
An array whose elements contain the substrings in this instance that are delimited by the separator.

split

public static java.lang.String[] split(java.lang.String str,
                                       char[] separator)
Returns a String array containing the substrings in this instance that are delimited by elements of a specified char array.

Parameters:
str - The String to split.
separator - An array of Unicode characters that delimit the substrings in this instance, an empty array containing no delimiters, or null.
Returns:
An array whose elements contain the substrings in this instance that are delimited by one or more characters in separator.

split

public static java.lang.String[] split(java.lang.String str,
                                       char[] separator,
                                       int count)
Returns a String array containing the substrings in this instance that are delimited by elements of a specified char array. A parameter specifies the maximum number of substrings to return.

Parameters:
str - The String to split.
separator - An array of Unicode characters that delimit the substrings in this instance, an empty array containing no delimiters, or null.
count - The maximum number of substrings to return.
Returns:
An array whose elements contain the substrings in this instance that are delimited by one or more characters in separator.
Throws:
java.lang.StringIndexOutOfBoundsException - count is negative.

split

public static java.lang.String[] split(java.lang.String str,
                                       char[] separator,
                                       short options)
Returns a String array containing the substrings in this string that are delimited by elements of a specified char array. A parameter specifies whether to return empty array elements.

Parameters:
str - The String to split.
separator - An array of Unicode characters that delimit the substrings in this string, an empty array containing no delimiters, or null.
options - Specify STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES to omit empty array elements from the array returned, or STRINGSPLITOPTIONS_NONE to include empty array elements in the array returned.
Returns:
An array whose elements contain the substrings in this string that are delimited by one or more characters in separator.
Throws:
java.lang.IllegalArgumentException - options is not one of the STRINGSPLITOPTIONS_* values.

split

public static java.lang.String[] split(java.lang.String str,
                                       java.lang.String[] separator,
                                       short options)
Returns a String array containing the substrings in this string that are delimited by elements of a specified String array. A parameter specifies whether to return empty array elements.

Parameters:
str - The String to split.
separator - An array of strings that delimit the substrings in this string, an empty array containing no delimiters, or null.
options - Specify STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES to omit empty array elements from the array returned, or STRINGSPLITOPTIONS_NONE to include empty array elements in the array returned.
Returns:
An array whose elements contain the substrings in this string that are delimited by one or more strings in separator.
Throws:
java.lang.IllegalArgumentException - options is not one of the STRINGSPLITOPTIONS_* values.

split

public static java.lang.String[] split(java.lang.String str,
                                       char[] separator,
                                       int count,
                                       short options)
Returns a String array containing the substrings in this string that are delimited by elements of a specified char array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.

Parameters:
str - The String to split.
separator - An array of Unicode characters that delimit the substrings in this string, an empty array containing no delimiters, or null.
count - The maximum number of substrings to return.
options - Specify STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES to omit empty array elements from the array returned, or STRINGSPLITOPTIONS_NONE to include empty array elements in the array returned.
Returns:
An array whose elements contain the substrings in this stringthat are delimited by one or more characters in separator.
Throws:
java.lang.StringIndexOutOfBoundsException - count is negative.
java.lang.IllegalArgumentException - options is not one of the STRINGSPLITOPTIONS_* values.

split

public static java.lang.String[] split(java.lang.String str,
                                       java.lang.String[] separator,
                                       int count,
                                       short options)
Returns a String array containing the substrings in this string that are delimited by elements of a specified String array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.

Parameters:
str - The String to split.
separator - An array of strings that delimit the substrings in this string, an empty array containing no delimiters, or null.
count - The maximum number of substrings to return.
options - Specify STRINGSPLITOPTIONS_REMOVEEMPTYENTRIES to omit empty array elements from the array returned, or STRINGSPLITOPTIONS_NONE to include empty array elements in the array returned.
Returns:
An array whose elements contain the substrings in this string that are delimited by one or more strings in separator.
Throws:
java.lang.StringIndexOutOfBoundsException - count is negative.
java.lang.IllegalArgumentException - options is not one of the STRINGSPLITOPTIONS_* values.

compareOrdinal

public static int compareOrdinal(java.lang.String strA,
                                 int indexA,
                                 java.lang.String strB,
                                 int indexB,
                                 int length)
Compares substrings of two specified String objects by evaluating the numeric values of the corresponding char objects in each substring.

Parameters:
strA - The first String.
indexA - The starting index of the substring in strA.
strB - The second String.
indexB - The starting index of the substring in strB.
length - The maximum number of characters in the substrings to compare.
Returns:
A 32-bit signed integer indicating the lexical relationship between the two comparands. ValueCondition Less than zero: The substring in strA is less than the substring in strB. Zero: The substrings are equal, or length is zero. Greater than zero: The substring in strA is greater than the substring in strB.

format_java

public static java.lang.String format_java(java.lang.String format,
                                           java.lang.Object arg0)
Format a string.

Parameters:
format - The string format to use.
arg0 - The argument to apply to the string format.
Returns:
The formatted string.

format_java

public static java.lang.String format_java(java.lang.String format,
                                           java.lang.Object arg0,
                                           java.lang.Object arg1)
Format a string.

Parameters:
format - The string format to use.
arg0 - The argument to apply to the string format.
arg1 - The argument to apply to the string format.
Returns:
The formatted string.

format_java

public static java.lang.String format_java(java.lang.String format,
                                           java.lang.Object arg0,
                                           java.lang.Object arg1,
                                           java.lang.Object arg2)
Format a string.

Parameters:
format - The string format to use.
arg0 - The argument to apply to the string format.
arg1 - The argument to apply to the string format.
arg2 - The argument to apply to the string format.
Returns:
The formatted string.

format_java

public static java.lang.String format_java(java.lang.String format,
                                           java.lang.Object[] args)
Format a string. Based off java.text.MessageFormat

Parameters:
format - The string format to use.
args - The arguments to apply to the string format.
Returns:
The formatted string.

format_printf

public static java.lang.String format_printf(java.lang.String format,
                                             java.lang.Object arg0)
Format a string.

Parameters:
format - The string format to use.
arg0 - The argument to apply to the string format.
Returns:
The formatted string.
Since:
BBX 1.2.0

format_printf

public static java.lang.String format_printf(java.lang.String format,
                                             java.lang.Object arg0,
                                             java.lang.Object arg1)
Format a string.

Parameters:
format - The string format to use.
arg0 - The argument to apply to the string format.
arg1 - The argument to apply to the string format.
Returns:
The formatted string.
Since:
BBX 1.2.0

format_printf

public static java.lang.String format_printf(java.lang.String format,
                                             java.lang.Object arg0,
                                             java.lang.Object arg1,
                                             java.lang.Object arg2)
Format a string.

Parameters:
format - The string format to use.
arg0 - The argument to apply to the string format.
arg1 - The argument to apply to the string format.
arg2 - The argument to apply to the string format.
Returns:
The formatted string.
Since:
BBX 1.2.0

format_printf

public static java.lang.String format_printf(java.lang.String format,
                                             java.lang.Object[] args)
Format a string.

Parameters:
format - The string format to use.
args - The arguments to apply to the string format.
Returns:
The formatted string or null if an error occurred.
Since:
BBX 1.2.0

append

public static java.lang.StringBuffer append(java.lang.StringBuffer buf,
                                            char value,
                                            int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to the end of the StringBuffer.

Parameters:
buf - The StringBuffer to append the chars to.
value - The character to append.
repeatCount - The number of times to append value.
Returns:
A reference to the StringBuffer after the append operation has completed.
Throws:
java.lang.IndexOutOfBoundsException - repeatCount is less than zero.

append

public static java.lang.StringBuffer append(java.lang.StringBuffer buf,
                                            char value,
                                            int repeatCount,
                                            int index)
Appends a specified number of copies of the string representation of a Unicode character to the end of the StringBuffer.

Parameters:
buf - The StringBuffer to append the chars to.
value - The character to append.
repeatCount - The number of times to append value.
index - The location to append the chars. If the chars should be added to the end of the StringBuffer then -1 should be passed, if the value is greater then the current length of the StringBuffer then it will be added to the end. This cannot be less then -1.
Returns:
A reference to the StringBuffer after the append operation has completed.
Throws:
java.lang.IndexOutOfBoundsException - repeatCount is less than zero. -or- index is less then -1.

append

public static java.lang.StringBuffer append(java.lang.StringBuffer buf,
                                            java.lang.String value,
                                            int startIndex,
                                            int index,
                                            boolean indexIsLength)
Appends a section of string to the specified StringBuffer.

Parameters:
buf - The StringBuffer to append the String to.
value - The String to append.
startIndex - The starting index of value to append.
index - A value (see indexIsLength).
indexIsLength - If true then index is the number of chars to append, if false then it is the ending index of the String to append.
Returns:
A reference to the StringBuffer after the append operation has completed.

delete

public static java.lang.StringBuffer delete(java.lang.StringBuffer buf,
                                            int startingIndex,
                                            int length)
Removes the characters in a substring of a StringBuffer.

Parameters:
buf - The StringBuffer to remove chars from.
startingIndex - The beginning index, inclusive.
length - The number of characters to remove.
Returns:
The string buffer.
Throws:
java.lang.StringIndexOutOfBoundsException - If startingIndex is negative, greater than length(), or, when length is added, greater than end.

toBase64String

public static java.lang.String toBase64String(byte[] inArray)
Converts the value of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits.

Parameters:
inArray - An array of 8-bit signed integers.
Returns:
The String representation, in base 64, of the contents of inArray.
Throws:
java.lang.NullPointerException - inArray is null.

toBase64String

public static java.lang.String toBase64String(byte[] inArray,
                                              int options)
Converts a subset of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits. A parameter specifies whether to insert line breaks in the return value.

Parameters:
inArray - An array of 8-bit signed integers.
options - BASE64FORMATTINGOPTIONS_INSERTLINEBREAKS to insert a line break every 76 characters, or BASE64FORMATTINGOPTIONS_NONE to not insert line breaks.
Returns:
The String representation in base 64 of the elements in inArray.
Throws:
java.lang.IllegalArgumentException - options is not a valid Base64FormattingOptions_* value.
java.lang.NullPointerException - inArray is null.

toBase64String

public static java.lang.String toBase64String(byte[] inArray,
                                              int offset,
                                              int length)
Converts a subset of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits. Parameters specify the subset as an offset in the input array, and the number of elements in the array to convert.

Parameters:
inArray - An array of 8-bit signed integers.
offset - An offset in inArray.
length - The number of elements of inArray to convert.
Returns:
The String representation in base 64 of length elements of inArray starting at position offset.
Throws:
java.lang.ArrayIndexOutOfBoundsException - offset or length is negative.-or- offset plus length is greater than the length of inArray.
java.lang.NullPointerException - inArray is null.

toBase64String

public static java.lang.String toBase64String(byte[] inArray,
                                              int offset,
                                              int length,
                                              int options)
Converts a subset of an array of 8-bit signed integers to its equivalent String representation encoded with base 64 digits. Parameters specify the subset as an offset in the input array, the number of elements in the array to convert, and whether to insert line breaks in the return value.

Parameters:
inArray - An array of 8-bit signed integers.
offset - An offset in inArray.
length - The number of elements of inArray to convert.
options - BASE64FORMATTINGOPTIONS_INSERTLINEBREAKS to insert a line break every 76 characters, or BASE64FORMATTINGOPTIONS_NONE to not insert line breaks.
Returns:
The String representation in base 64 of length elements of inArray starting at position offset.
Throws:
java.lang.ArrayIndexOutOfBoundsException - offset or length is negative.-or- offset plus length is greater than the length of inArray.
java.lang.IllegalArgumentException - options is not a valid Base64FormattingOptions_* value.
java.lang.NullPointerException - inArray is null.

toBase64CharArray

public static int toBase64CharArray(byte[] inArray,
                                    int offsetIn,
                                    int length,
                                    char[] outArray,
                                    int offsetOut)
Converts a subset of an 8-bit signed integer array to an equivalent subset of a Unicode character array encoded with base 64 digits. Parameters specify the subsets as offsets in the input and output arrays, the number of elements in the input array to convert, and whether line breaks are inserted in the output array.

Parameters:
inArray - An input array of 8-bit unsigned integers.
offsetIn - A position within inArray.
length - The number of elements of inArray to convert.
outArray - An output array of Unicode characters.
offsetOut - A position within outArray.
Returns:
A 32-bit signed integer containing the number of bytes in outArray.
Throws:
java.lang.ArrayIndexOutOfBoundsException - offsetIn, offsetOut, or length is negative.-or- offsetIn plus length is greater than the length of inArray.-or- offsetOut plus the number of elements to return is greater than the length of outArray.
java.lang.NullPointerException - inArray or outArray is null.

toBase64CharArray

public static int toBase64CharArray(byte[] inArray,
                                    int offsetIn,
                                    int length,
                                    char[] outArray,
                                    int offsetOut,
                                    int options)
Converts a subset of an 8-bit signed integer array to an equivalent subset of a Unicode character array encoded with base 64 digits. Parameters specify the subsets as offsets in the input and output arrays, the number of elements in the input array to convert, and whether line breaks are inserted in the output array.

Parameters:
inArray - An input array of 8-bit unsigned integers.
offsetIn - A position within inArray.
length - The number of elements of inArray to convert.
outArray - An output array of Unicode characters.
offsetOut - A position within outArray.
options - BASE64FORMATTINGOPTIONS_INSERTLINEBREAKS to insert a line break every 76 characters, or BASE64FORMATTINGOPTIONS_NONE to not insert line breaks.
Returns:
A 32-bit signed integer containing the number of bytes in outArray.
Throws:
java.lang.ArrayIndexOutOfBoundsException - offsetIn, offsetOut, or length is negative.-or- offsetIn plus length is greater than the length of inArray.-or- offsetOut plus the number of elements to return is greater than the length of outArray.
java.lang.IllegalArgumentException - options is not a valid Base64FormattingOptions_* value.
java.lang.NullPointerException - inArray or outArray is null.

fromBase64CharArray

public static byte[] fromBase64CharArray(char[] inArray,
                                         int offset,
                                         int length)
Converts a subset of a Unicode character array, which encodes binary data as base 64 digits, to an equivalent 8-bit unsigned integer array. Parameters specify the subset in the input array and the number of elements to convert.

Parameters:
inArray - A Unicode character array.
offset - A position within inArray.
length - The number of elements in inArray to convert.
Returns:
An array of 8-bit signed integers equivalent to length elements at position offset in inArray.
Throws:
java.io.IOException - The length of s, ignoring white space characters, is not zero or a multiple of 4. -or-The format of s is invalid. s contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.
java.lang.ArrayIndexOutOfBoundsException - offset or length is less than 0.-or- offset plus length indicates a position not within inArray.
java.lang.NullPointerException - inArray is null.

fromBase64String

public static byte[] fromBase64String(java.lang.String s)
Converts the specified String, which encodes binary data as base 64 digits, to an equivalent 8-bit signed integer array.

Parameters:
s - A String.
Returns:
An array of 8-bit signed integers equivalent to s.
Throws:
java.lang.NullPointerException - s is null.
java.io.IOException - The length of s, ignoring white space characters, is not zero or a multiple of 4. -or-The format of s is invalid. s contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.

forDigit

public static char forDigit(int digit,
                            int radix)
Get the character value for the specified numeric digit.

Parameters:
digit - The numeric digit to retrieve.
radix - The radix the resulting character should be.
Returns:
The digit converted to a character of the specified radix. Or a null char (value of zero) will be returned if parameters are not correct.
Since:
BBX 1.2.0

vsnprintf

public static int vsnprintf(java.lang.StringBuffer buffer,
                            int count,
                            java.lang.String format,
                            java.lang.Object[] argptr)
Print formatted variable argument list to a string buffer.

Parameters:
buffer - The string buffer to write to.
count - Maximum number of characters to write. If this is less then zero then it will not truncate the output.
format - Format string to write to the buffer.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

vsnprintf

public static int vsnprintf(char[] buffer,
                            int count,
                            java.lang.String format,
                            java.lang.Object[] argptr)
Print formatted variable argument list to a char array.

Parameters:
buffer - The char array to write to.
count - Maximum number of characters to write. If this is less then zero then it will not truncate the output.
format - Format string to write to the buffer.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

sprintf

public static int sprintf(java.lang.StringBuffer buffer,
                          java.lang.String format,
                          java.lang.Object[] argptr)
Print formatted variable argument list to a string buffer.

Parameters:
buffer - The string buffer to write to.
format - Format string to write to the buffer.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

sprintf

public static int sprintf(char[] buffer,
                          java.lang.String format,
                          java.lang.Object[] argptr)
Print formatted variable argument list to a char array.

Parameters:
buffer - The char array to write to.
format - Format string to write to the buffer.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

printf

public static int printf(java.lang.String format,
                         java.lang.Object[] argptr)
Print formatted data to System.out

Parameters:
format - Format string to write to System.out.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

fprintf

public static int fprintf(java.io.PrintStream stream,
                          java.lang.String format,
                          java.lang.Object[] argptr)
Write formatted output to a print stream.

Parameters:
stream - The print stream to write to.
format - Format string to write to the stream.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

fprintf

public static int fprintf(java.io.OutputStream stream,
                          java.lang.String format,
                          java.lang.Object[] argptr)
Write formatted output to a output stream.

Parameters:
stream - The print stream to write to.
format - Format string to write to the stream.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

fprintf

public static int fprintf(Stream stream,
                          java.lang.String format,
                          java.lang.Object[] argptr)
Write formatted output to a stream.

Parameters:
stream - The print stream to write to.
format - Format string to write to the stream.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

fprintf

public static int fprintf(java.io.PrintStream stream,
                          int count,
                          java.lang.String format,
                          java.lang.Object[] argptr)
Write formatted output to a print stream.

Parameters:
stream - The print stream to write to.
count - Maximum number of characters to write. If this is less then zero then it will not truncate the output.
format - Format string to write to the stream.
argptr - Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.
Returns:
On success, the total number of characters written is returned. On failure, a negative number is returned.
Since:
BBX 1.2.0

sscanf

public static int sscanf(java.lang.String str,
                         java.lang.String format,
                         java.lang.Object[] argptr)
Read formatted data from string.

Parameters:
str - String that the function processes as its source to retrieve the data.
format - String describing the format of str.
argptr - The function expects a sequence of pointers as additional arguments, each one pointing to an object of the type specified by their corresponding %-tag within the format string, in the same order.
Returns:
On success, the function returns the number of variables filled. This count can match the expected number of readings or fewer, even zero, if a matching failure happens.
Since:
BBX 1.2.0

fscanf

public static int fscanf(Stream file,
                         java.lang.String format,
                         java.lang.Object[] argptr)
Read formatted data from a stream.

Parameters:
file - The stream to read data from.
format - String describing the format of file.
argptr - The function expects a sequence of pointers as additional arguments, each one pointing to an object of the type specified by their corresponding %-tag within the format string, in the same order.
Returns:
On success, the function returns the number of variables filled. This count can match the expected number of readings or fewer, even zero, if a matching failure happens.
Since:
BBX 1.2.0

fscanf

public static int fscanf(java.io.InputStream file,
                         java.lang.String format,
                         java.lang.Object[] argptr)
Read formatted data from a input stream.

Parameters:
file - The stream to read data from.
format - String describing the format of file.
argptr - The function expects a sequence of pointers as additional arguments, each one pointing to an object of the type specified by their corresponding %-tag within the format string, in the same order.
Returns:
On success, the function returns the number of variables filled. This count can match the expected number of readings or fewer, even zero, if a matching failure happens.
Since:
BBX 1.2.0