public class SNI
extends java.lang.Object
Constructor and Description |
---|
SNI() |
Modifier and Type | Method and Description |
---|---|
static void |
toCString(java.lang.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 java.lang.String |
toJavaString(byte[] cString)
Transforms a C String into a Java String,
using platform default encoding.
|
public static void toCString(java.lang.String javaString, byte[] cString)
cString
array length
must be at least javaString.length()+1
.javaString
- the Java StringcString
- byte array which contains the C String.java.lang.IllegalArgumentException
- if javaString or cString is nulljava.lang.ArrayIndexOutOfBoundsException
- if cString is too small to contain the stringpublic static java.lang.String toJavaString(byte[] cString)
cString
- byte array which contains the C Stringjava.lang.IllegalArgumentException
- if cString is null or its length is < 1java.lang.IllegalArgumentException
- if cString is not NULL terminated.