public final class Strings
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
fromAsciiBytes(byte[] bytes,
int ofs,
int len)
Convert a sequence of ASCII bytes into a string.
|
static int |
toAsciiBytes(java.lang.String s,
byte[] bytes,
int ofs)
Brutally convert a string to a sequence of ASCII bytes by
discarding all but the lower 7 bits of each
char in
s . |
public static int toAsciiBytes(java.lang.String s, byte[] bytes, int ofs)
char
in
s
.
The primary purpose of this method is to implement a speedy converter between strings and bytes where characters are known to be limited to the ASCII character set.
Note that the output will consume exactly s.length()
bytes.
s
- The string to convert.bytes
- The buffer to place the converted bytes into.ofs
- The offset within the buffer to place the converted bytes.public static java.lang.String fromAsciiBytes(byte[] bytes, int ofs, int len)
bytes
- The buffer to convert to a string.ofs
- The offset within the buffer to start conversion.len
- The number of bytes to convert.String
of length len
.