java.lang.CharSequencepublic class ByteArrayCharSequence
extends java.lang.Object
implements java.lang.CharSequence
An instance of this adapter can be reused by wrapping a new byte array.
Note that for convenience this class exposes a hashCode() method that
return the same result as String, but equality is not by content.
| Constructor | Description |
|---|---|
ByteArrayCharSequence() |
Creates a new empty byte-array character sequence.
|
ByteArrayCharSequence(byte[] b) |
Creates a new byte-array character sequence using the provided byte array.
|
ByteArrayCharSequence(byte[] b,
int offset,
int length) |
Creates a new byte-array character sequence using the provided byte-array fragment.
|
| Modifier and Type | Method | Description |
|---|---|---|
char |
charAt(int index) |
|
int |
hashCode() |
|
int |
length() |
|
java.lang.CharSequence |
subSequence(int start,
int end) |
|
java.lang.String |
toString() |
|
void |
wrap(byte[] b) |
Wraps a byte array into this byte-array character sequence.
|
ByteArrayCharSequence |
wrap(byte[] b,
int offset,
int length) |
Wraps a byte-array fragment into this byte-array character sequence.
|
public ByteArrayCharSequence(byte[] b,
int offset,
int length)
b - a byte array.offset - the first valid byte in b.length - the number of valid bytes in b, starting at offset.public ByteArrayCharSequence(byte[] b)
b - a byte array.public ByteArrayCharSequence()
public ByteArrayCharSequence wrap(byte[] b, int offset, int length)
b - a byte array.offset - the first valid byte in b.length - the number of valid bytes in b, starting at offset.public void wrap(byte[] b)
b - a byte array.public int length()
length in interface java.lang.CharSequencepublic char charAt(int index)
charAt in interface java.lang.CharSequencepublic java.lang.CharSequence subSequence(int start,
int end)
subSequence in interface java.lang.CharSequencepublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object