public final class Charsets
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.nio.charset.Charset |
LATIN_1
The
8859_1 character set. |
static java.nio.charset.Charset |
UTF_8
The
UTF-8 character set. |
| Modifier | Constructor and Description |
|---|---|
private |
Charsets() |
| Modifier and Type | Method and Description |
|---|---|
static int |
encodedLengthOf(java.lang.String src)
Get the encoded length of a string.
|
static boolean |
encodeTo(java.lang.String src,
byte[] dest,
int offs)
Encode a string into UTF-8 (except encoding character zero to its two-byte form).
|
static int |
indexOf(byte[] array,
int search)
Find the first occurrence of a byte in a byte array.
|
static int |
indexOf(byte[] array,
int search,
int offs)
Find the first occurrence of a byte in a byte array.
|
static int |
indexOf(byte[] array,
int search,
int offs,
int len)
Find the first occurrence of a byte in a byte array.
|
public static final java.nio.charset.Charset UTF_8
UTF-8 character set.public static final java.nio.charset.Charset LATIN_1
8859_1 character set.public static boolean encodeTo(java.lang.String src,
byte[] dest,
int offs)
src - the source stringdest - the array to encode tooffs - the offset into the destination arraytrue if the string fit, false if it did notpublic static int encodedLengthOf(java.lang.String src)
src - the stringpublic static int indexOf(byte[] array,
int search,
int offs,
int len)
array - the array to searchsearch - the byte to search foroffs - the offset in the array to start searchinglen - the length of the segment to searchpublic static int indexOf(byte[] array,
int search,
int offs)
array - the array to searchsearch - the byte to search foroffs - the offset in the array to start searchingpublic static int indexOf(byte[] array,
int search)
array - the array to searchsearch - the byte to search for