public final class ASCII8BitUTF
extends java.lang.Object
implements java.lang.CharSequence
ASCII8BitUTF
traverse a String byte by byte. It uses ACII8Bit to
encode String characters which have codepoints between 0-255 into single byte
and remains other String characters as UTF8 encoding.RubyString.unpack(java.lang.String)
to use.Constructor and Description |
---|
ASCII8BitUTF(java.lang.String str)
Returns a
ASCII8BitUTF . |
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
hasNextByte()
Checks if there are remaining bytes.
|
boolean |
hasNextChar()
Checks if there are remaining characters.
|
int |
length() |
byte |
nextByte()
Returns next byte.
|
byte[] |
nextByte(int n)
Returns next n as maximum bytes.
|
java.lang.String |
nextChar()
Returns next character.
|
java.lang.String |
nextChar(int n)
Returns next n as maximum chars.
|
int |
remainingByteNumber()
Returns the remaining number of bytes.
|
void |
rewind()
Rewinds this
ASCII8BitUTF . |
java.lang.CharSequence |
subSequence(int start,
int end) |
java.lang.String |
toString() |
int |
totalByteNumber()
Returns the total number of bytes.
|
public ASCII8BitUTF(java.lang.String str)
ASCII8BitUTF
.str
- any Stringpublic int totalByteNumber()
public int remainingByteNumber()
public void rewind()
ASCII8BitUTF
.public boolean hasNextChar()
public boolean hasNextByte()
public java.lang.String nextChar()
java.lang.IllegalStateException
- if no more character is leftpublic java.lang.String nextChar(int n)
n
- maximum number of charspublic byte nextByte()
java.lang.IllegalStateException
- if no more byte is leftpublic byte[] nextByte(int n)
n
- maximum number of bytespublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public int length()
length
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence