blob: 1e4928ba458c9701ec34605a2016c9a9db931239 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_292) on Tue Jun 15 06:00:49 GMT 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Text (Apache Hadoop Main 3.3.1 API)</title>
<meta name="date" content="2021-06-15">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Text (Apache Hadoop Main 3.3.1 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":9,"i2":10,"i3":10,"i4":10,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":9,"i19":9,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":9,"i26":10,"i27":9,"i28":9,"i29":9,"i30":10,"i31":10,"i32":9,"i33":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<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="class-use/Text.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/hadoop/io/Stringifier.html" title="interface in org.apache.hadoop.io"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/hadoop/io/TwoDArrayWritable.html" title="class in org.apache.hadoop.io"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/hadoop/io/Text.html" target="_top">Frames</a></li>
<li><a href="Text.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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">org.apache.hadoop.io</div>
<h2 title="Class Text" class="title">Class Text</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">org.apache.hadoop.io.BinaryComparable</a></li>
<li>
<ul class="inheritance">
<li>org.apache.hadoop.io.Text</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a>&lt;<a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a>&gt;, <a href="../../../../org/apache/hadoop/io/Writable.html" title="interface in org.apache.hadoop.io">Writable</a>, <a href="../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</a>&lt;<a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a>&gt;</dd>
</dl>
<hr>
<br>
<pre>@Stringable
@InterfaceAudience.Public
@InterfaceStability.Stable
public class <span class="typeNameLabel">Text</span>
extends <a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a>
implements <a href="../../../../org/apache/hadoop/io/WritableComparable.html" title="interface in org.apache.hadoop.io">WritableComparable</a>&lt;<a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a>&gt;</pre>
<div class="block">This class stores text using standard UTF8 encoding. It provides methods
to serialize, deserialize, and compare texts at byte level. The type of
length is integer and is serialized using zero-compressed format. <p>In
addition, it provides methods for string traversal without converting the
byte array to a string. <p>Also includes utilities for
serializing/deserialing a string, coding/decoding a string, checking if a
byte array contains valid UTF8 code, calculating the length of an encoded
string.</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="memberSummary" 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>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#DEFAULT_MAX_LEN">DEFAULT_MAX_LEN</a></span></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" 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><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#Text--">Text</a></span>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#Text-byte:A-">Text</a></span>(byte[]&nbsp;utf8)</code>
<div class="block">Construct from a byte array.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#Text-java.lang.String-">Text</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</code>
<div class="block">Construct from a string.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#Text-org.apache.hadoop.io.Text-">Text</a></span>(<a href="../../../../org/apache/hadoop/io/Text.html" title="class in org.apache.hadoop.io">Text</a>&nbsp;utf8)</code>
<div class="block">Construct from another text.</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="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#append-byte:A-int-int-">append</a></span>(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;len)</code>
<div class="block">Append a range of bytes to the end of the given text</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#bytesToCodePoint-java.nio.ByteBuffer-">bytesToCodePoint</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;bytes)</code>
<div class="block">Returns the next code point at the current position in
the buffer.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#charAt-int-">charAt</a></span>(int&nbsp;position)</code>
<div class="block">Returns the Unicode Scalar Value (32-bit integer value)
for the character at <code>position</code>.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#clear--">clear</a></span>()</code>
<div class="block">Clear the string to empty.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#copyBytes--">copyBytes</a></span>()</code>
<div class="block">Get a copy of the bytes that is exactly the length of the data.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#decode-byte:A-">decode</a></span>(byte[]&nbsp;utf8)</code>
<div class="block">Converts the provided byte array to a String using the
UTF-8 encoding.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#decode-byte:A-int-int-">decode</a></span>(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;length)</code>&nbsp;</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#decode-byte:A-int-int-boolean-">decode</a></span>(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;length,
boolean&nbsp;replace)</code>
<div class="block">Converts the provided byte array to a String using the
UTF-8 encoding.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#encode-java.lang.String-">encode</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</code>
<div class="block">Converts the provided String to bytes using the
UTF-8 encoding.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#encode-java.lang.String-boolean-">encode</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string,
boolean&nbsp;replace)</code>
<div class="block">Converts the provided String to bytes using the
UTF-8 encoding.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#equals-java.lang.Object-">equals</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;o)</code>
<div class="block">Returns true iff <code>o</code> is a Text with the same contents.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#find-java.lang.String-">find</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;what)</code>&nbsp;</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#find-java.lang.String-int-">find</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;what,
int&nbsp;start)</code>
<div class="block">Finds any occurrence of <code>what</code> in the backing
buffer, starting as position <code>start</code>.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#getBytes--">getBytes</a></span>()</code>
<div class="block">Returns the raw bytes; however, only data up to <a href="../../../../org/apache/hadoop/io/Text.html#getLength--"><code>getLength()</code></a> is
valid.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#getLength--">getLength</a></span>()</code>
<div class="block">Returns the number of bytes in the byte array</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#hashCode--">hashCode</a></span>()</code>
<div class="block">Return a hash of the bytes returned from {#getBytes()}.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#readFields-java.io.DataInput-">readFields</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in)</code>
<div class="block">deserialize</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#readFields-java.io.DataInput-int-">readFields</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in,
int&nbsp;maxLength)</code>&nbsp;</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#readString-java.io.DataInput-">readString</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in)</code>
<div class="block">Read a UTF8 encoded string from in</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#readString-java.io.DataInput-int-">readString</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in,
int&nbsp;maxLength)</code>
<div class="block">Read a UTF8 encoded string with a maximum size</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#readWithKnownLength-java.io.DataInput-int-">readWithKnownLength</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in,
int&nbsp;len)</code>
<div class="block">Read a Text object whose length is already known.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#set-byte:A-">set</a></span>(byte[]&nbsp;utf8)</code>
<div class="block">Set to a utf8 byte array</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#set-byte:A-int-int-">set</a></span>(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;len)</code>
<div class="block">Set the Text to range of bytes</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#set-java.lang.String-">set</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</code>
<div class="block">Set to contain the contents of a string.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#set-org.apache.hadoop.io.Text-">set</a></span>(<a href="../../../../org/apache/hadoop/io/Text.html" title="class in org.apache.hadoop.io">Text</a>&nbsp;other)</code>
<div class="block">copy a text.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#skip-java.io.DataInput-">skip</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in)</code>
<div class="block">Skips over one Text in the input.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#toString--">toString</a></span>()</code>
<div class="block">Convert text back to string</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#utf8Length-java.lang.String-">utf8Length</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</code>
<div class="block">For the given string, returns the number of UTF-8 bytes
required to encode the string.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#validateUTF8-byte:A-">validateUTF8</a></span>(byte[]&nbsp;utf8)</code>
<div class="block">Check if a byte array contains valid utf-8</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#validateUTF8-byte:A-int-int-">validateUTF8</a></span>(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;len)</code>
<div class="block">Check to see if a byte array is valid utf-8</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#write-java.io.DataOutput-">write</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out)</code>
<div class="block">serialize
write this object to out
length uses zero-compressed encoding</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#write-java.io.DataOutput-int-">write</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out,
int&nbsp;maxLength)</code>&nbsp;</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#writeString-java.io.DataOutput-java.lang.String-">writeString</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s)</code>
<div class="block">Write a UTF8 encoded string to out</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/hadoop/io/Text.html#writeString-java.io.DataOutput-java.lang.String-int-">writeString</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
int&nbsp;maxLength)</code>
<div class="block">Write a UTF8 encoded string with a maximum size to out</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.hadoop.io.BinaryComparable">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.hadoop.io.<a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a></h3>
<code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html#compareTo-org.apache.hadoop.io.BinaryComparable-">compareTo</a>, <a href="../../../../org/apache/hadoop/io/BinaryComparable.html#compareTo-byte:A-int-int-">compareTo</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Comparable">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Comparable.html?is-external=true#compareTo-T-" title="class or interface in java.lang">compareTo</a></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="DEFAULT_MAX_LEN">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DEFAULT_MAX_LEN</h4>
<pre>public static final&nbsp;int DEFAULT_MAX_LEN</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.hadoop.io.Text.DEFAULT_MAX_LEN">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Text--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Text</h4>
<pre>public&nbsp;Text()</pre>
</li>
</ul>
<a name="Text-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Text</h4>
<pre>public&nbsp;Text(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</pre>
<div class="block">Construct from a string.</div>
</li>
</ul>
<a name="Text-org.apache.hadoop.io.Text-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Text</h4>
<pre>public&nbsp;Text(<a href="../../../../org/apache/hadoop/io/Text.html" title="class in org.apache.hadoop.io">Text</a>&nbsp;utf8)</pre>
<div class="block">Construct from another text.</div>
</li>
</ul>
<a name="Text-byte:A-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Text</h4>
<pre>public&nbsp;Text(byte[]&nbsp;utf8)</pre>
<div class="block">Construct from a byte array.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="copyBytes--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>copyBytes</h4>
<pre>public&nbsp;byte[]&nbsp;copyBytes()</pre>
<div class="block">Get a copy of the bytes that is exactly the length of the data.
See <a href="../../../../org/apache/hadoop/io/Text.html#getBytes--"><code>getBytes()</code></a> for faster access to the underlying array.</div>
</li>
</ul>
<a name="getBytes--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBytes</h4>
<pre>public&nbsp;byte[]&nbsp;getBytes()</pre>
<div class="block">Returns the raw bytes; however, only data up to <a href="../../../../org/apache/hadoop/io/Text.html#getLength--"><code>getLength()</code></a> is
valid. Please use <a href="../../../../org/apache/hadoop/io/Text.html#copyBytes--"><code>copyBytes()</code></a> if you
need the returned array to be precisely the length of the data.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html#getBytes--">getBytes</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a></code></dd>
</dl>
</li>
</ul>
<a name="getLength--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLength</h4>
<pre>public&nbsp;int&nbsp;getLength()</pre>
<div class="block">Returns the number of bytes in the byte array</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html#getLength--">getLength</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a></code></dd>
</dl>
</li>
</ul>
<a name="charAt-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>charAt</h4>
<pre>public&nbsp;int&nbsp;charAt(int&nbsp;position)</pre>
<div class="block">Returns the Unicode Scalar Value (32-bit integer value)
for the character at <code>position</code>. Note that this
method avoids using the converter or doing String instantiation</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Unicode scalar value at position or -1
if the position is invalid or points to a
trailing byte</dd>
</dl>
</li>
</ul>
<a name="find-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>find</h4>
<pre>public&nbsp;int&nbsp;find(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;what)</pre>
</li>
</ul>
<a name="find-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>find</h4>
<pre>public&nbsp;int&nbsp;find(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;what,
int&nbsp;start)</pre>
<div class="block">Finds any occurrence of <code>what</code> in the backing
buffer, starting as position <code>start</code>. The starting
position is measured in bytes and the return value is in
terms of byte position in the buffer. The backing buffer is
not converted to a string for this operation.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>byte position of the first occurrence of the search
string in the UTF-8 buffer or -1 if not found</dd>
</dl>
</li>
</ul>
<a name="set-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre>public&nbsp;void&nbsp;set(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</pre>
<div class="block">Set to contain the contents of a string.</div>
</li>
</ul>
<a name="set-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre>public&nbsp;void&nbsp;set(byte[]&nbsp;utf8)</pre>
<div class="block">Set to a utf8 byte array</div>
</li>
</ul>
<a name="set-org.apache.hadoop.io.Text-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre>public&nbsp;void&nbsp;set(<a href="../../../../org/apache/hadoop/io/Text.html" title="class in org.apache.hadoop.io">Text</a>&nbsp;other)</pre>
<div class="block">copy a text.</div>
</li>
</ul>
<a name="set-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set</h4>
<pre>public&nbsp;void&nbsp;set(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;len)</pre>
<div class="block">Set the Text to range of bytes</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>utf8</code> - the data to copy from</dd>
<dd><code>start</code> - the first position of the new string</dd>
<dd><code>len</code> - the number of bytes of the new string</dd>
</dl>
</li>
</ul>
<a name="append-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>append</h4>
<pre>public&nbsp;void&nbsp;append(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;len)</pre>
<div class="block">Append a range of bytes to the end of the given text</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>utf8</code> - the data to copy from</dd>
<dd><code>start</code> - the first position to append from utf8</dd>
<dd><code>len</code> - the number of bytes to append</dd>
</dl>
</li>
</ul>
<a name="clear--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>public&nbsp;void&nbsp;clear()</pre>
<div class="block">Clear the string to empty.
<em>Note</em>: For performance reasons, this call does not clear the
underlying byte array that is retrievable via <a href="../../../../org/apache/hadoop/io/Text.html#getBytes--"><code>getBytes()</code></a>.
In order to free the byte-array memory, call <a href="../../../../org/apache/hadoop/io/Text.html#set-byte:A-"><code>set(byte[])</code></a>
with an empty byte array (For example, <code>new byte[0]</code>).</div>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString()</pre>
<div class="block">Convert text back to string</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang"><code>Object.toString()</code></a></dd>
</dl>
</li>
</ul>
<a name="readFields-java.io.DataInput-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readFields</h4>
<pre>public&nbsp;void&nbsp;readFields(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">deserialize</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/hadoop/io/Writable.html#readFields-java.io.DataInput-">readFields</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/hadoop/io/Writable.html" title="interface in org.apache.hadoop.io">Writable</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>in</code> - <code>DataInput</code> to deseriablize this object from.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="readFields-java.io.DataInput-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readFields</h4>
<pre>public&nbsp;void&nbsp;readFields(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in,
int&nbsp;maxLength)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="skip-java.io.DataInput-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>skip</h4>
<pre>public static&nbsp;void&nbsp;skip(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Skips over one Text in the input.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="readWithKnownLength-java.io.DataInput-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readWithKnownLength</h4>
<pre>public&nbsp;void&nbsp;readWithKnownLength(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in,
int&nbsp;len)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Read a Text object whose length is already known.
This allows creating Text from a stream which uses a different serialization
format.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="write-java.io.DataOutput-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>write</h4>
<pre>public&nbsp;void&nbsp;write(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">serialize
write this object to out
length uses zero-compressed encoding</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/hadoop/io/Writable.html#write-java.io.DataOutput-">write</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../org/apache/hadoop/io/Writable.html" title="interface in org.apache.hadoop.io">Writable</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>out</code> - <code>DataOuput</code> to serialize this object into.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/hadoop/io/Writable.html#write-java.io.DataOutput-"><code>Writable.write(DataOutput)</code></a></dd>
</dl>
</li>
</ul>
<a name="write-java.io.DataOutput-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>write</h4>
<pre>public&nbsp;void&nbsp;write(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out,
int&nbsp;maxLength)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></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(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;o)</pre>
<div class="block">Returns true iff <code>o</code> is a Text with the same contents.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html#equals-java.lang.Object-">equals</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a></code></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"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html#hashCode--">BinaryComparable</a></code></span></div>
<div class="block">Return a hash of the bytes returned from {#getBytes()}.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html#hashCode--">hashCode</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/hadoop/io/BinaryComparable.html" title="class in org.apache.hadoop.io">BinaryComparable</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/hadoop/io/WritableComparator.html#hashBytes-byte:A-int-"><code>WritableComparator.hashBytes(byte[],int)</code></a></dd>
</dl>
</li>
</ul>
<a name="decode-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decode</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;decode(byte[]&nbsp;utf8)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></pre>
<div class="block">Converts the provided byte array to a String using the
UTF-8 encoding. If the input is malformed,
replace by a default value.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></code></dd>
</dl>
</li>
</ul>
<a name="decode-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decode</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;decode(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;length)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></code></dd>
</dl>
</li>
</ul>
<a name="decode-byte:A-int-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decode</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;decode(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;length,
boolean&nbsp;replace)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></pre>
<div class="block">Converts the provided byte array to a String using the
UTF-8 encoding. If <code>replace</code> is true, then
malformed input is replaced with the
substitution character, which is U+FFFD. Otherwise the
method throws a MalformedInputException.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></code></dd>
</dl>
</li>
</ul>
<a name="encode-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encode</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;encode(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></pre>
<div class="block">Converts the provided String to bytes using the
UTF-8 encoding. If the input is malformed,
invalid chars are replaced by a default value.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ByteBuffer: bytes stores at ByteBuffer.array()
and length is ByteBuffer.limit()</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></code></dd>
</dl>
</li>
</ul>
<a name="encode-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encode</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;encode(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string,
boolean&nbsp;replace)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></pre>
<div class="block">Converts the provided String to bytes using the
UTF-8 encoding. If <code>replace</code> is true, then
malformed input is replaced with the
substitution character, which is U+FFFD. Otherwise the
method throws a MalformedInputException.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ByteBuffer: bytes stores at ByteBuffer.array()
and length is ByteBuffer.limit()</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharacterCodingException.html?is-external=true" title="class or interface in java.nio.charset">CharacterCodingException</a></code></dd>
</dl>
</li>
</ul>
<a name="readString-java.io.DataInput-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;readString(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Read a UTF8 encoded string from in</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="readString-java.io.DataInput-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;readString(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</a>&nbsp;in,
int&nbsp;maxLength)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Read a UTF8 encoded string with a maximum size</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="writeString-java.io.DataOutput-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeString</h4>
<pre>public static&nbsp;int&nbsp;writeString(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Write a UTF8 encoded string to out</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="writeString-java.io.DataOutput-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeString</h4>
<pre>public static&nbsp;int&nbsp;writeString(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</a>&nbsp;out,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
int&nbsp;maxLength)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Write a UTF8 encoded string with a maximum size to out</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="validateUTF8-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validateUTF8</h4>
<pre>public static&nbsp;void&nbsp;validateUTF8(byte[]&nbsp;utf8)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/MalformedInputException.html?is-external=true" title="class or interface in java.nio.charset">MalformedInputException</a></pre>
<div class="block">Check if a byte array contains valid utf-8</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>utf8</code> - byte array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/MalformedInputException.html?is-external=true" title="class or interface in java.nio.charset">MalformedInputException</a></code> - if the byte array contains invalid utf-8</dd>
</dl>
</li>
</ul>
<a name="validateUTF8-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validateUTF8</h4>
<pre>public static&nbsp;void&nbsp;validateUTF8(byte[]&nbsp;utf8,
int&nbsp;start,
int&nbsp;len)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/MalformedInputException.html?is-external=true" title="class or interface in java.nio.charset">MalformedInputException</a></pre>
<div class="block">Check to see if a byte array is valid utf-8</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>utf8</code> - the array of bytes</dd>
<dd><code>start</code> - the offset of the first byte in the array</dd>
<dd><code>len</code> - the length of the byte sequence</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/charset/MalformedInputException.html?is-external=true" title="class or interface in java.nio.charset">MalformedInputException</a></code> - if the byte array contains invalid bytes</dd>
</dl>
</li>
</ul>
<a name="bytesToCodePoint-java.nio.ByteBuffer-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bytesToCodePoint</h4>
<pre>public static&nbsp;int&nbsp;bytesToCodePoint(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;bytes)</pre>
<div class="block">Returns the next code point at the current position in
the buffer. The buffer's position will be incremented.
Any mark set on this buffer will be changed by this method!</div>
</li>
</ul>
<a name="utf8Length-java.lang.String-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>utf8Length</h4>
<pre>public static&nbsp;int&nbsp;utf8Length(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;string)</pre>
<div class="block">For the given string, returns the number of UTF-8 bytes
required to encode the string.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>string</code> - text to encode</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>number of UTF-8 bytes required to encode</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>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<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="class-use/Text.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/hadoop/io/Stringifier.html" title="interface in org.apache.hadoop.io"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/hadoop/io/TwoDArrayWritable.html" title="class in org.apache.hadoop.io"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/hadoop/io/Text.html" target="_top">Frames</a></li>
<li><a href="Text.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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 ======= -->
<p class="legalCopy"><small>Copyright &#169; 2021 <a href="https://www.apache.org">Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>