Top Description Inners Fields Constructors Methods
org.bouncycastle.util

public final Class Strings

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, .OutputStream, java.security.AccessController, .PrivilegedAction, java.util.ArrayList, .Vector, org.bouncycastle.util.encoders.UTF8

String utilities.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static char[]

Returns:

resulting String.
asCharArray
(byte[]
8 bit characters.
bytes
)

Do a simple conversion of an array of 8 bit characters into a string.

public static boolean

Returns:

true if a and b represent the same string, false otherwise.
constantTimeAreEqual
(String
a string.
a
,
String
another string to compare to a.
b
)

Constant time string comparison.

public static String

Returns:

resulting String.
fromByteArray
(byte[]
8 bit characters.
bytes
)

Convert an array of 8 bit characters into a string.

public static String
fromUTF8ByteArray(byte[] bytes)

public static String
fromUTF8ByteArray(byte[] bytes, int off, int length)

public static String
public static StringList
public static String[]
split(String input, char delimiter)

public static byte[]
toByteArray(char[] chars)

public static byte[]
public static int
toByteArray(String s, byte[] buf, int off)

public static String

Returns:

a US ASCII lowercase version
toLowerCase
(String
input to be converted
string
)

A locale independent version of toLowerCase.

public static String

Returns:

a US Ascii uppercase version
toUpperCase
(String
input to be converted
string
)

A locale independent version of toUpperCase.

public static byte[]
public static byte[]
toUTF8ByteArray(char[] string)

public static void
toUTF8ByteArray(char[] string, OutputStream sOut)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LINE_SEPARATORback to summary
private static String LINE_SEPARATOR

Constructor Detail

Stringsback to summary
public Strings()

Method Detail

asCharArrayback to summary
public static char[] asCharArray(byte[] bytes)

Do a simple conversion of an array of 8 bit characters into a string.

Parameters
bytes:byte[]

8 bit characters.

Returns:char[]

resulting String.

constantTimeAreEqualback to summary
public static boolean constantTimeAreEqual(String a, String b)

Constant time string comparison.

Parameters
a:String

a string.

b:String

another string to compare to a.

Returns:boolean

true if a and b represent the same string, false otherwise.

fromByteArrayback to summary
public static String fromByteArray(byte[] bytes)

Convert an array of 8 bit characters into a string.

Parameters
bytes:byte[]

8 bit characters.

Returns:String

resulting String.

fromUTF8ByteArrayback to summary
public static String fromUTF8ByteArray(byte[] bytes)
fromUTF8ByteArrayback to summary
public static String fromUTF8ByteArray(byte[] bytes, int off, int length)
lineSeparatorback to summary
public static String lineSeparator()
newListback to summary
public static StringList newList()
splitback to summary
public static String[] split(String input, char delimiter)
toByteArrayback to summary
public static byte[] toByteArray(char[] chars)
toByteArrayback to summary
public static byte[] toByteArray(String string)
toByteArrayback to summary
public static int toByteArray(String s, byte[] buf, int off)
toLowerCaseback to summary
public static String toLowerCase(String string)

A locale independent version of toLowerCase.

Parameters
string:String

input to be converted

Returns:String

a US ASCII lowercase version

toUpperCaseback to summary
public static String toUpperCase(String string)

A locale independent version of toUpperCase.

Parameters
string:String

input to be converted

Returns:String

a US Ascii uppercase version

toUTF8ByteArrayback to summary
public static byte[] toUTF8ByteArray(String string)
toUTF8ByteArrayback to summary
public static byte[] toUTF8ByteArray(char[] string)
toUTF8ByteArrayback to summary
public static void toUTF8ByteArray(char[] string, OutputStream sOut) throws IOException
org.bouncycastle.util back to summary

private Class Strings.StringListImpl

extends ArrayList<String>
implements StringList
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.StringList, org.bouncycastle.util.Iterable, java.lang.Iterable

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
add(String
the String to add.
s
)

Overrides java.util.ArrayList.add.

Implements org.bouncycastle.util.StringList.add, java.util.List.add, java.util.Collection.add.

Add a String to the list.

public void
add(int
index at which the specified element is to be inserted
index
,
String
element to be inserted
element
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list.

public String
set(int
index of the element to replace
index
,
String
element to be stored at the specified position
element
)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element.

public String[]
toStringArray()

Implements org.bouncycastle.util.StringList.toStringArray.

Return the contents of the list as an array.

public String[]
toStringArray(int
the initial index of the range to be copied, inclusive
from
,
int
the final index of the range to be copied, exclusive.
to
)

Implements org.bouncycastle.util.StringList.toStringArray.

Return a section of the contents of the list.

Inherited from java.util.ArrayList:
addAlladdAlladdFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsizesortspliteratorsubListtoArraytoArraytrimToSize

Constructor Detail

StringListImplback to summary
private StringListImpl()

Method Detail

addback to summary
public boolean add(String s)

Overrides java.util.ArrayList.add.

Implements org.bouncycastle.util.StringList.add, java.util.List.add, java.util.Collection.add.

Doc from org.bouncycastle.util.StringList.add.

Add a String to the list.

Parameters
s:String

the String to add.

Returns:boolean

true

addback to summary
public void add(int index, String element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Doc from java.util.ArrayList.add.

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters
index:int

index at which the specified element is to be inserted

element:String

element to be inserted

setback to summary
public String set(int index, String element)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Doc from java.util.ArrayList.set.

Replaces the element at the specified position in this list with the specified element.

Parameters
index:int

index of the element to replace

element:String

element to be stored at the specified position

Returns:String

the element previously at the specified position

toStringArrayback to summary
public String[] toStringArray()

Implements org.bouncycastle.util.StringList.toStringArray.

Doc from org.bouncycastle.util.StringList.toStringArray.

Return the contents of the list as an array.

Returns:String[]

an array of String.

toStringArrayback to summary
public String[] toStringArray(int from, int to)

Implements org.bouncycastle.util.StringList.toStringArray.

Doc from org.bouncycastle.util.StringList.toStringArray.

Return a section of the contents of the list. If the list is too short the array is filled with nulls.

Parameters
from:int

the initial index of the range to be copied, inclusive

to:int

the final index of the range to be copied, exclusive.

Returns:String[]

an array of length to - from