public class ByteBackedCharSequence extends Object implements CharSequence
Constructor and Description |
---|
ByteBackedCharSequence(byte[] bytes)
Creates a new ByteBackedCharSequence based on the given char sequence which stores the given byte array as its internal byte array.
|
ByteBackedCharSequence(char[] characters)
Constructs a new ByteBackedCharSequence based on the given char sequence
|
ByteBackedCharSequence(CharSequence sequence)
Constructs a new ByteBackedCharSequence based on the given char sequence
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
byte[] |
getBytes() |
int |
length() |
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
public ByteBackedCharSequence(byte[] bytes)
bytes
- the contents of this array must not be modified after this constructor is invoked.public ByteBackedCharSequence(CharSequence sequence)
sequence
- the sequence to store as an array of bytes.IllegalArgumentException
- if any of the characters in sequence are not in the range 0 to 127 inclusivepublic ByteBackedCharSequence(char[] characters)
characters
- the characters to store as an array of bytes.IllegalArgumentException
- if any of the characters in sequence are not in the range 0 to 127 inclusivepublic int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public byte[] getBytes()
public String toString()
toString
in interface CharSequence
toString
in class Object