public class Kim
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
length
The number of bytes in the kim.
|
Constructor and Description |
---|
Kim(byte[] bytes,
int length)
Make a kim from a byte array.
|
Kim(byte[] bytes,
int from,
int thru)
Make a kim from a portion of a byte array.
|
Kim(Kim kim,
int from,
int thru)
Make a new kim from a substring of an existing kim.
|
Kim(java.lang.String string)
Make a kim from a string.
|
Modifier and Type | Method and Description |
---|---|
int |
characterAt(int at)
Returns the character at the specified index.
|
static int |
characterSize(int character)
Returns the number of bytes needed to contain the character in Kim
format.
|
int |
copy(byte[] bytes,
int at)
Copy the contents of this kim to a byte array.
|
boolean |
equals(java.lang.Object obj)
Two kim objects containing exactly the same bytes in the same order are
equal to each other.
|
int |
get(int at)
Get a byte from a kim.
|
int |
hashCode()
Returns a hash code value for the kim.
|
java.lang.String |
toString()
Produce a UTF-16 String from this kim.
|
public int length
public Kim(byte[] bytes, int from, int thru)
bytes
- A byte array.from
- The index of the first byte.thru
- The index of the last byte plus one.public Kim(byte[] bytes, int length)
bytes
- The byte array.length
- The number of bytes.public Kim(Kim kim, int from, int thru)
kim
- The source of bytes.from
- The point at which to take bytes.thru
- The point at which to stop taking bytes.public Kim(java.lang.String string) throws JSONException
string
- The string.JSONException
- if surrogate pair mismatch.public int characterAt(int at) throws JSONException
at
- the index of the char value. The first character is at 0.JSONException
- if at does not point to a valid character.public static int characterSize(int character) throws JSONException
character
- a Unicode character between 0 and 0x10FFFF.JSONException
- if the character is not representable in a kim.public int copy(byte[] bytes, int at)
bytes
- A byte array of sufficient size.at
- The position within the byte array to take the byes.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other kim with which to compare.public int get(int at) throws JSONException
at
- The position of the byte. The first byte is at 0.JSONException
- if there is no byte at that position.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString() throws JSONException
toString
in class java.lang.Object
JSONException
- if the kim is not valid.