Package org.bouncycastle.util
Class Strings
java.lang.Object
org.bouncycastle.util.Strings
String utilities.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic char[]
asCharArray
(byte[] bytes) Do a simple conversion of an array of 8 bit characters into a string.static boolean
constantTimeAreEqual
(String a, String b) Constant time string comparison.static String
fromByteArray
(byte[] bytes) Convert an array of 8 bit characters into a string.static String
fromUTF8ByteArray
(byte[] bytes) static String
fromUTF8ByteArray
(byte[] bytes, int off, int length) static String
static StringList
newList()
static String[]
static byte[]
toByteArray
(char[] chars) static byte[]
toByteArray
(String string) static int
toByteArray
(String s, byte[] buf, int off) static String
toLowerCase
(String string) A locale independent version of toLowerCase.static String
toUpperCase
(String string) A locale independent version of toUpperCase.static byte[]
toUTF8ByteArray
(char[] string) static void
toUTF8ByteArray
(char[] string, OutputStream sOut) static byte[]
toUTF8ByteArray
(String string)
-
Constructor Details
-
Strings
public Strings()
-
-
Method Details
-
fromUTF8ByteArray
-
fromUTF8ByteArray
-
toUTF8ByteArray
-
toUTF8ByteArray
public static byte[] toUTF8ByteArray(char[] string) -
toUTF8ByteArray
- Throws:
IOException
-
toUpperCase
A locale independent version of toUpperCase.- Parameters:
string
- input to be converted- Returns:
- a US Ascii uppercase version
-
toLowerCase
A locale independent version of toLowerCase.- Parameters:
string
- input to be converted- Returns:
- a US ASCII lowercase version
-
toByteArray
public static byte[] toByteArray(char[] chars) -
toByteArray
-
toByteArray
-
constantTimeAreEqual
Constant time string comparison.- Parameters:
a
- a string.b
- another string to compare to a.- Returns:
- true if a and b represent the same string, false otherwise.
-
fromByteArray
Convert an array of 8 bit characters into a string.- Parameters:
bytes
- 8 bit characters.- Returns:
- resulting String.
-
asCharArray
public static char[] asCharArray(byte[] bytes) Do a simple conversion of an array of 8 bit characters into a string.- Parameters:
bytes
- 8 bit characters.- Returns:
- resulting String.
-
split
-
newList
-
lineSeparator
-