public class SNI extends Object
Constructor and Description |
---|
SNI() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
toCString(String javaString)
Transforms a Java String into a C String.
The platform default encoding is used to transform Java characters into C characters. The returned C String is a NULL terminated String (ends with '\0'). |
static void |
toCString(String javaString,
byte[] cString)
Transforms a Java String into a C String.
The platform default encoding is used to transform Java characters into C characters. The created C String is a NULL terminated String (ends with '\0'). |
static String |
toJavaString(byte[] cString)
Transforms a C String into a Java String,
using platform default encoding.
|
public static byte[] toCString(String javaString)
javaString
- the Java String to convert.IllegalArgumentException
- if javaString is null.public static void toCString(String javaString, byte[] cString)
cString
array length
must be at least javaString.length()+1
.javaString
- the Java String to convert.cString
- byte array which contains the C String.IllegalArgumentException
- if javaString or cString is null.ArrayIndexOutOfBoundsException
- if cString is too small to contain the string.public static String toJavaString(byte[] cString)
cString
- byte array which contains the C String.IllegalArgumentException
- if cString is null or its length is < 1.IllegalArgumentException
- if cString is not NULL terminated.