PlotSquared/doc/com/intellectualcrafters/json/Kim.html
2014-11-16 11:14:40 +01:00

641 lines
31 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="sv">
<head>
<!-- Generated by javadoc (version 1.7.0_67) on Sun Nov 16 11:09:55 CET 2014 -->
<title>Kim</title>
<meta name="date" content="2014-11-16">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title = "Kim";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/intellectualcrafters/json/JSONWriter.html"
title="class in com.intellectualcrafters.json"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../com/intellectualcrafters/json/Property.html"
title="class in com.intellectualcrafters.json"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/intellectualcrafters/json/Kim.html" target="_top">Frames</a></li>
<li><a href="Kim.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if (window == top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.intellectualcrafters.json</div>
<h2 title="Class Kim" class="title">Class Kim</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.intellectualcrafters.json.Kim</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">Kim</span>
extends java.lang.Object</pre>
<div class="block">Kim makes immutable eight bit Unicode strings. If the MSB of a byte is set,
then the next byte is a continuation byte. The last byte of a character
never has the MSB reset. Every byte that is not the last byte has the MSB
set. Kim stands for "Keep it minimal". A Unicode character is never longer
than 3 bytes. Every byte contributes 7 bits to the character. ASCII is
unmodified.
<p/>
Kim UTF-8
one byte U+007F U+007F
two bytes U+3FFF U+07FF
three bytes U+10FFF U+FFFF
four bytes U+10FFFF
<p/>
Characters in the ranges U+0800..U+3FFF and U+10000..U+10FFFF will be one
byte smaller when encoded in Kim compared to UTF-8.
<p/>
Kim is beneficial when using scripts such as Old South Arabian, Aramaic,
Avestan, Balinese, Batak, Bopomofo, Buginese, Buhid, Carian, Cherokee,
Coptic, Cyrillic, Deseret, Egyptian Hieroglyphs, Ethiopic, Georgian,
Glagolitic, Gothic, Hangul Jamo, Hanunoo, Hiragana, Kanbun, Kaithi,
Kannada, Katakana, Kharoshthi, Khmer, Lao, Lepcha, Limbu, Lycian, Lydian,
Malayalam, Mandaic, Meroitic, Miao, Mongolian, Myanmar, New Tai Lue,
Ol Chiki, Old Turkic, Oriya, Osmanya, Pahlavi, Parthian, Phags-Pa,
Phoenician, Samaritan, Sharada, Sinhala, Sora Sompeng, Tagalog, Tagbanwa,
Takri, Tai Le, Tai Tham, Tamil, Telugu, Thai, Tibetan, Tifinagh, UCAS.
<p/>
A kim object can be constructed from an ordinary UTF-16 string, or from a
byte array. A kim object can produce a UTF-16 string.
<p/>
As with UTF-8, it is possible to detect character boundaries within a byte
sequence. UTF-8 is one of the world's great inventions. While Kim is more
efficient, it is not clear that it is worth the expense of transition.
</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#length">length</a></strong></code>
<div class="block">The number of bytes in the kim.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#Kim(byte[],%20int)">Kim</a></strong>(byte[]&nbsp;bytes,
int&nbsp;length)</code>
<div class="block">Make a kim from a byte array.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#Kim(byte[],%20int,%20int)">Kim</a></strong>(byte[]&nbsp;bytes,
int&nbsp;from,
int&nbsp;thru)</code>
<div class="block">Make a kim from a portion of a byte array.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#Kim(com.intellectualcrafters.json.Kim,%20int,%20int)">Kim</a></strong>(<a
href="../../../com/intellectualcrafters/json/Kim.html"
title="class in com.intellectualcrafters.json">Kim</a>&nbsp;kim,
int&nbsp;from,
int&nbsp;thru)</code>
<div class="block">Make a new kim from a substring of an existing kim.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#Kim(java.lang.String)">Kim</a></strong>(java.lang.String&nbsp;string)</code>
<div class="block">Make a kim from a string.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#characterAt(int)">characterAt</a></strong>(int&nbsp;at)</code>
<div class="block">Returns the character at the specified index.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#characterSize(int)">characterSize</a></strong>(int&nbsp;character)</code>
<div class="block">Returns the number of bytes needed to contain the character in Kim
format.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#copy(byte[],%20int)">copy</a></strong>(byte[]&nbsp;bytes,
int&nbsp;at)</code>
<div class="block">Copy the contents of this kim to a byte array.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object&nbsp;obj)</code>
<div class="block">Two kim objects containing exactly the same bytes in the same order
are
equal to each other.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#get(int)">get</a></strong>(int&nbsp;at)</code>
<div class="block">Get a byte from a kim.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#hashCode()">hashCode</a></strong>()</code>
<div class="block">Returns a hash code value for the kim.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a
href="../../../com/intellectualcrafters/json/Kim.html#toString()">toString</a></strong>()</code>
<div class="block">Produce a UTF-16 String from this kim.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, finalize, getClass, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="length">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>length</h4>
<pre>public&nbsp;int length</pre>
<div class="block">The number of bytes in the kim. The number of bytes can be as much as
three times the number of characters.
</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Kim(byte[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Kim</h4>
<pre>public&nbsp;Kim(byte[]&nbsp;bytes,
int&nbsp;from,
int&nbsp;thru)</pre>
<div class="block">Make a kim from a portion of a byte array.</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>bytes</code> - A byte array.</dd>
<dd><code>from</code> - The index of the first byte.</dd>
<dd><code>thru</code> - The index of the last byte plus one.</dd>
</dl>
</li>
</ul>
<a name="Kim(byte[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Kim</h4>
<pre>public&nbsp;Kim(byte[]&nbsp;bytes,
int&nbsp;length)</pre>
<div class="block">Make a kim from a byte array.</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>bytes</code> - The byte array.</dd>
<dd><code>length</code> - The number of bytes.</dd>
</dl>
</li>
</ul>
<a name="Kim(com.intellectualcrafters.json.Kim, int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Kim</h4>
<pre>public&nbsp;Kim(<a href="../../../com/intellectualcrafters/json/Kim.html"
title="class in com.intellectualcrafters.json">Kim</a>&nbsp;kim,
int&nbsp;from,
int&nbsp;thru)</pre>
<div class="block">Make a new kim from a substring of an existing kim. The coordinates are
in byte units, not character units.
</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>kim</code> - The source of bytes.</dd>
<dd><code>from</code> - The point at which to take bytes.</dd>
<dd><code>thru</code> - The point at which to stop taking bytes.</dd>
</dl>
</li>
</ul>
<a name="Kim(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Kim</h4>
<pre>public&nbsp;Kim(java.lang.String&nbsp;string)
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></pre>
<div class="block">Make a kim from a string.</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>string</code> - The string.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></code> - if
surrogate pair mismatch.
</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="characterSize(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>characterSize</h4>
<pre>public static&nbsp;int&nbsp;characterSize(int&nbsp;character)
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></pre>
<div class="block">Returns the number of bytes needed to contain the character in Kim
format.
</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>character</code> - a Unicode character between 0 and 0x10FFFF.</dd>
<dt><span class="strong">Returns:</span></dt>
<dd>1, 2, or 3</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></code> - if
the character is not representable in a kim.
</dd>
</dl>
</li>
</ul>
<a name="characterAt(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>characterAt</h4>
<pre>public&nbsp;int&nbsp;characterAt(int&nbsp;at)
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></pre>
<div class="block">Returns the character at the specified index. The index refers to byte
values and ranges from 0 to length - 1. The index of the next character
is at index + Kim.characterSize(kim.characterAt(index)).
</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>at</code> - the index of the char value. The first character is at 0.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></code> - if at
does not point to a valid character.
</dd>
</dl>
</li>
</ul>
<a name="copy(byte[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copy</h4>
<pre>public&nbsp;int&nbsp;copy(byte[]&nbsp;bytes,
int&nbsp;at)</pre>
<div class="block">Copy the contents of this kim to a byte array.</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>bytes</code> - A byte array of sufficient size.</dd>
<dd><code>at</code> - The position within the byte array to take the byes.</dd>
<dt><span class="strong">Returns:</span></dt>
<dd>The position immediately after the copy.</dd>
</dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre>public&nbsp;boolean&nbsp;equals(java.lang.Object&nbsp;obj)</pre>
<div class="block">Two kim objects containing exactly the same bytes in the same order are
equal to each other.
</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>equals</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>obj</code> - the other kim with which to compare.</dd>
</dl>
</li>
</ul>
<a name="get(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>get</h4>
<pre>public&nbsp;int&nbsp;get(int&nbsp;at)
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></pre>
<div class="block">Get a byte from a kim.</div>
<dl>
<dt><span class="strong">Parameters:</span></dt>
<dd><code>at</code> - The position of the byte. The first byte is at 0.</dd>
<dt><span class="strong">Returns:</span></dt>
<dd>The byte.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></code> - if
there is no byte at that position.
</dd>
</dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>public&nbsp;int&nbsp;hashCode()</pre>
<div class="block">Returns a hash code value for the kim.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>hashCode</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;java.lang.String&nbsp;toString()
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></pre>
<div class="block">Produce a UTF-16 String from this kim. The number of codepoints in the
string will not be greater than the number of bytes in the kim, although
it could be less.
</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
<dt><span class="strong">Returns:</span></dt>
<dd>The string. A kim memoizes its string representation.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
title="class in com.intellectualcrafters.json">JSONException</a></code> - if
the kim is not valid.
</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../com/intellectualcrafters/json/JSONWriter.html"
title="class in com.intellectualcrafters.json"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../com/intellectualcrafters/json/Property.html"
title="class in com.intellectualcrafters.json"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/intellectualcrafters/json/Kim.html" target="_top">Frames</a></li>
<li><a href="Kim.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if (window == top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field_summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field_detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>