Replace instances of Text with String (#120)

diff --git a/src/main/java/org/apache/accumulo/examples/client/RandomBatchWriter.java b/src/main/java/org/apache/accumulo/examples/client/RandomBatchWriter.java
index 03b6fbb..2038b64 100644
--- a/src/main/java/org/apache/accumulo/examples/client/RandomBatchWriter.java
+++ b/src/main/java/org/apache/accumulo/examples/client/RandomBatchWriter.java
@@ -34,7 +34,6 @@
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.examples.cli.BatchWriterOpts;
 import org.apache.accumulo.examples.cli.ClientOnRequiredTable;
-import org.apache.hadoop.io.Text;
 
 import com.beust.jcommander.Parameter;
 
@@ -83,15 +82,14 @@
    * @return a mutation
    */
   public static Mutation createMutation(long rowid, int dataSize, ColumnVisibility visibility) {
-    Text row = new Text(String.format("row_%010d", rowid));
 
-    Mutation m = new Mutation(row);
+    Mutation m = new Mutation(String.format("row_%010d", rowid));
 
     // create a random value that is a function of the
     // row id for verification purposes
     byte[] value = createValue(rowid, dataSize);
 
-    m.put(new Text("foo"), new Text("1"), visibility, new Value(value));
+    m.put("foo", "1", visibility, new Value(value));
 
     return m;
   }
diff --git a/src/main/java/org/apache/accumulo/examples/dirlist/Ingest.java b/src/main/java/org/apache/accumulo/examples/dirlist/Ingest.java
index 47794a1..daeb96f 100644
--- a/src/main/java/org/apache/accumulo/examples/dirlist/Ingest.java
+++ b/src/main/java/org/apache/accumulo/examples/dirlist/Ingest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.examples.dirlist;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -68,17 +70,17 @@
     if (path.equals("/"))
       path = "";
     Mutation m = new Mutation(QueryUtil.getRow(path));
-    Text colf;
+    String colf;
     if (isDir)
-      colf = QueryUtil.DIR_COLF;
+      colf = QueryUtil.DIR_COLF.toString();
     else
-      colf = new Text(encoder.encode(Long.MAX_VALUE - lastmod));
-    m.put(colf, new Text(LENGTH_CQ), cv, new Value(Long.toString(length).getBytes()));
-    m.put(colf, new Text(HIDDEN_CQ), cv, new Value(Boolean.toString(isHidden).getBytes()));
-    m.put(colf, new Text(EXEC_CQ), cv, new Value(Boolean.toString(canExec).getBytes()));
-    m.put(colf, new Text(LASTMOD_CQ), cv, new Value(Long.toString(lastmod).getBytes()));
+      colf = new String(encoder.encode(Long.MAX_VALUE - lastmod), UTF_8);
+    m.put(colf, LENGTH_CQ, cv, new Value(Long.toString(length).getBytes()));
+    m.put(colf, HIDDEN_CQ, cv, new Value(Boolean.toString(isHidden).getBytes()));
+    m.put(colf, EXEC_CQ, cv, new Value(Boolean.toString(canExec).getBytes()));
+    m.put(colf, LASTMOD_CQ, cv, new Value(Long.toString(lastmod).getBytes()));
     if (hash != null && hash.length() > 0)
-      m.put(colf, new Text(HASH_CQ), cv, new Value(hash.getBytes()));
+      m.put(colf, HASH_CQ, cv, new Value(hash.getBytes()));
     return m;
   }
 
diff --git a/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java b/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java
index 4249bcd..87bc67d 100644
--- a/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java
+++ b/src/main/java/org/apache/accumulo/examples/filedata/FileDataIngest.java
@@ -101,8 +101,7 @@
       }
     }
 
-    String hash = hexString(md5digest.digest());
-    Text row = new Text(hash);
+    String row = hexString(md5digest.digest());
 
     // write info to accumulo
     Mutation m = new Mutation(row);
@@ -147,7 +146,7 @@
     chunkCQ.append(intToBytes(chunkCount), 0, 4);
     m.put(new Text(CHUNK_CF), chunkCQ, cv, new Value(new byte[0]));
     bw.addMutation(m);
-    return hash;
+    return row;
   }
 
   public static int bytesToInt(byte[] b, int offset) {
diff --git a/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java b/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java
index 61cea3b..7de72ec 100644
--- a/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java
+++ b/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java
@@ -31,7 +31,6 @@
 import org.apache.accumulo.examples.Common;
 import org.apache.accumulo.examples.cli.BatchWriterOpts;
 import org.apache.accumulo.examples.cli.ClientOnRequiredTable;
-import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -76,12 +75,11 @@
       int value = 0;
 
       for (long i = 0; i < iterations; i++) {
-        Mutation m = new Mutation(new Text(String.format("%03d", row)));
+        Mutation m = new Mutation(String.format("%03d", row));
         row = (row + 1) % NUM_ROWS;
 
         for (int cq = 0; cq < NUM_COLUMNS; cq++)
-          m.put(new Text("000"), new Text(String.format("%04d", cq)),
-              new Value(("" + value).getBytes()));
+          m.put("000", String.format("%04d", cq), new Value(("" + value).getBytes()));
 
         value++;
 
diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java b/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java
index 257a353..cb7149a 100644
--- a/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java
+++ b/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java
@@ -44,7 +44,7 @@
     @Override
     public void map(Key row, Value data, Context context) throws IOException, InterruptedException {
       Mutation m = new Mutation(row.getRow());
-      m.put(new Text("cf-HASHTYPE"), new Text("cq-MD5BASE64"),
+      m.put("cf-HASHTYPE", "cq-MD5BASE64",
           new Value(Base64.getEncoder().encode(MD5Hash.digest(data.toString()).getDigest())));
       context.write(null, m);
       context.progress();
@@ -74,9 +74,9 @@
 
     String col = opts.column;
     int idx = col.indexOf(":");
-    Text cf = new Text(idx < 0 ? col : col.substring(0, idx));
-    Text cq = idx < 0 ? null : new Text(col.substring(idx + 1));
-    if (cf.getLength() > 0) {
+    String cf = idx < 0 ? col : col.substring(0, idx);
+    String cq = idx < 0 ? null : col.substring(idx + 1);
+    if (cf.length() > 0) {
       inputOpts.fetchColumns(Collections.singleton(new IteratorSetting.Column(cf, cq)));
     }
     inputOpts.store(job);
diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java b/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java
index 95a2630..71b8d5c 100644
--- a/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java
+++ b/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java
@@ -241,7 +241,7 @@
     private final Text value = new Text();
     private RandomGenerator rand;
     private byte[] keyBytes; // = new byte[12];
-    private final byte[] spaces = "          ".getBytes();
+    private final String spaces = "          ";
     private final byte[][] filler = new byte[26][];
     {
       for (int i = 0; i < 26; ++i) {
@@ -280,15 +280,15 @@
     /**
      * Add the rowid to the row.
      */
-    private Text getRowIdString(long rowId) {
-      Text paddedRowIdString = new Text();
-      byte[] rowid = Integer.toString((int) rowId).getBytes();
-      int padSpace = 10 - rowid.length;
+    private String getRowIdString(long rowId) {
+      StringBuilder paddedRowIdString = new StringBuilder();
+      String rowid = Integer.toString((int) rowId);
+      int padSpace = 10 - rowid.length();
       if (padSpace > 0) {
-        paddedRowIdString.append(spaces, 0, 10 - rowid.length);
+        paddedRowIdString.append(spaces, 0, padSpace);
       }
-      paddedRowIdString.append(rowid, 0, Math.min(rowid.length, 10));
-      return paddedRowIdString;
+      paddedRowIdString.append(rowid, 0, Math.min(rowid.length(), 10));
+      return paddedRowIdString.toString();
     }
 
     /**
@@ -332,7 +332,7 @@
 
       // New
       Mutation m = new Mutation(key);
-      m.put(new Text("c"), // column family
+      m.put("c", // column family
           getRowIdString(rowId), // column qual
           new Value(value.toString().getBytes())); // data
 
diff --git a/src/main/java/org/apache/accumulo/examples/reservations/ARS.java b/src/main/java/org/apache/accumulo/examples/reservations/ARS.java
index 852cb26..1836780 100644
--- a/src/main/java/org/apache/accumulo/examples/reservations/ARS.java
+++ b/src/main/java/org/apache/accumulo/examples/reservations/ARS.java
@@ -33,7 +33,6 @@
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -234,7 +233,7 @@
     try (
         Scanner scanner = new IsolatedScanner(client.createScanner(rTable, Authorizations.EMPTY))) {
       scanner.setRange(new Range(row));
-      scanner.fetchColumnFamily(new Text("res"));
+      scanner.fetchColumnFamily("res");
 
       List<String> reservations = new ArrayList<>();
 
diff --git a/src/main/java/org/apache/accumulo/examples/shard/Index.java b/src/main/java/org/apache/accumulo/examples/shard/Index.java
index bf675c4..63a12e0 100644
--- a/src/main/java/org/apache/accumulo/examples/shard/Index.java
+++ b/src/main/java/org/apache/accumulo/examples/shard/Index.java
@@ -28,7 +28,6 @@
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.examples.cli.ClientOpts;
-import org.apache.hadoop.io.Text;
 
 import com.beust.jcommander.Parameter;
 
@@ -40,16 +39,16 @@
  */
 public class Index {
 
-  static Text genPartition(int partition) {
-    return new Text(String.format("%08x", Math.abs(partition)));
+  static String genPartition(int partition) {
+    return String.format("%08x", Math.abs(partition));
   }
 
-  public static void index(int numPartitions, Text docId, String doc, String splitRegex,
+  public static void index(int numPartitions, String docId, String doc, String splitRegex,
       BatchWriter bw) throws Exception {
 
     String[] tokens = doc.split(splitRegex);
 
-    Text partition = genPartition(doc.hashCode() % numPartitions);
+    String partition = genPartition(doc.hashCode() % numPartitions);
 
     Mutation m = new Mutation(partition);
 
@@ -60,7 +59,7 @@
 
       if (!tokensSeen.contains(token)) {
         tokensSeen.add(token);
-        m.put(new Text(token), docId, new Value(new byte[0]));
+        m.put(token, docId, new Value(new byte[0]));
       }
     }
 
@@ -90,7 +89,7 @@
 
       fr.close();
 
-      index(numPartitions, new Text(src.getAbsolutePath()), sb.toString(), splitRegex, bw);
+      index(numPartitions, src.getAbsolutePath(), sb.toString(), splitRegex, bw);
     }
 
   }
diff --git a/src/test/java/org/apache/accumulo/examples/constraints/AlphaNumKeyConstraintTest.java b/src/test/java/org/apache/accumulo/examples/constraints/AlphaNumKeyConstraintTest.java
index a114ed9..17b8765 100644
--- a/src/test/java/org/apache/accumulo/examples/constraints/AlphaNumKeyConstraintTest.java
+++ b/src/test/java/org/apache/accumulo/examples/constraints/AlphaNumKeyConstraintTest.java
@@ -21,7 +21,6 @@
 
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
-import org.apache.hadoop.io.Text;
 import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
@@ -32,13 +31,13 @@
 
   @Test
   public void test() {
-    Mutation goodMutation = new Mutation(new Text("Row1"));
-    goodMutation.put(new Text("Colf2"), new Text("ColQ3"), new Value("value".getBytes()));
+    Mutation goodMutation = new Mutation("Row1");
+    goodMutation.put("Colf2", "ColQ3", new Value("value".getBytes()));
     assertNull(ankc.check(null, goodMutation));
 
     // Check that violations are in row, cf, cq order
-    Mutation badMutation = new Mutation(new Text("Row#1"));
-    badMutation.put(new Text("Colf$2"), new Text("Colq%3"), new Value("value".getBytes()));
+    Mutation badMutation = new Mutation("Row#1");
+    badMutation.put("Colf$2", "Colq%3", new Value("value".getBytes()));
     assertEquals(
         ImmutableList.of(AlphaNumKeyConstraint.NON_ALPHA_NUM_ROW,
             AlphaNumKeyConstraint.NON_ALPHA_NUM_COLF, AlphaNumKeyConstraint.NON_ALPHA_NUM_COLQ),
diff --git a/src/test/java/org/apache/accumulo/examples/constraints/NumericValueConstraintTest.java b/src/test/java/org/apache/accumulo/examples/constraints/NumericValueConstraintTest.java
index 1b0c72e..5feafe7 100644
--- a/src/test/java/org/apache/accumulo/examples/constraints/NumericValueConstraintTest.java
+++ b/src/test/java/org/apache/accumulo/examples/constraints/NumericValueConstraintTest.java
@@ -21,7 +21,6 @@
 
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
-import org.apache.hadoop.io.Text;
 import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.Iterables;
@@ -32,14 +31,14 @@
 
   @Test
   public void testCheck() {
-    Mutation goodMutation = new Mutation(new Text("r"));
-    goodMutation.put(new Text("cf"), new Text("cq"), new Value("1234".getBytes()));
+    Mutation goodMutation = new Mutation("r");
+    goodMutation.put("cf", "cq", new Value("1234".getBytes()));
     assertNull(nvc.check(null, goodMutation));
 
     // Check that multiple bad mutations result in one violation only
-    Mutation badMutation = new Mutation(new Text("r"));
-    badMutation.put(new Text("cf"), new Text("cq"), new Value("foo1234".getBytes()));
-    badMutation.put(new Text("cf2"), new Text("cq2"), new Value("foo1234".getBytes()));
+    Mutation badMutation = new Mutation("r");
+    badMutation.put("cf", "cq", new Value("foo1234".getBytes()));
+    badMutation.put("cf2", "cq2", new Value("foo1234".getBytes()));
     assertEquals(NumericValueConstraint.NON_NUMERIC_VALUE,
         Iterables.getOnlyElement(nvc.check(null, badMutation)).shortValue());
   }
diff --git a/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java b/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java
index 51f6f9a..72214ff 100644
--- a/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java
+++ b/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java
@@ -38,7 +38,6 @@
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.test.functional.ConfigurableMacBase;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -83,7 +82,7 @@
   @Test
   public void test() throws Exception {
     Scanner scanner = client.createScanner(tableName, new Authorizations());
-    scanner.fetchColumn(new Text("dir"), new Text("counts"));
+    scanner.fetchColumn("dir", "counts");
     assertFalse(scanner.iterator().hasNext());
 
     ScannerOpts scanOpts = new ScannerOpts();
diff --git a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamIT.java b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamIT.java
index 66cb18c..948bb54 100644
--- a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamIT.java
+++ b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamIT.java
@@ -126,8 +126,7 @@
 
   static void addData(List<Entry<Key,Value>> data, String row, String cf, String cq, String vis,
       String value) {
-    data.add(new KeyValue(new Key(new Text(row), new Text(cf), new Text(cq), new Text(vis)),
-        value.getBytes()));
+    data.add(new KeyValue(new Key(row, cf, cq, vis), value.getBytes()));
   }
 
   static void addData(List<Entry<Key,Value>> data, String row, String cf, int chunkSize,
diff --git a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamTest.java b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamTest.java
index e0bc356..70819e9 100644
--- a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamTest.java
+++ b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputStreamTest.java
@@ -90,8 +90,7 @@
 
   private static void addData(List<Entry<Key,Value>> data, String row, String cf, String cq,
       String vis, String value) {
-    data.add(new KeyValue(new Key(new Text(row), new Text(cf), new Text(cq), new Text(vis)),
-        value.getBytes()));
+    data.add(new KeyValue(new Key(row, cf, cq, vis), value.getBytes()));
   }
 
   private static void addData(List<Entry<Key,Value>> data, String row, String cf, int chunkSize,
diff --git a/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java b/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java
index 740d08c..cbad3cf 100644
--- a/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java
+++ b/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java
@@ -40,7 +40,6 @@
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.test.functional.ConfigurableMacBase;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
 import org.junit.jupiter.api.Test;
 
 public class MapReduceIT extends ConfigurableMacBase {
@@ -87,7 +86,7 @@
       assertEquals(0, hash.getProcess().waitFor());
 
       Scanner s = client.createScanner(tablename, Authorizations.EMPTY);
-      s.fetchColumn(new Text(input_cf), new Text(output_cq));
+      s.fetchColumn(input_cf, output_cq);
       int i = 0;
       for (Entry<Key,Value> entry : s) {
         MessageDigest md = MessageDigest.getInstance("MD5");