accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject git commit: ACCUMULO-2684 Create toStringNoTruncate to always print the entire Key
Date Wed, 16 Apr 2014 23:13:56 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master ecfdf8d7c -> e5d10032f


ACCUMULO-2684 Create toStringNoTruncate to always print the entire Key


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e5d10032
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e5d10032
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e5d10032

Branch: refs/heads/master
Commit: e5d10032fcd3d352b45355c8fa32df293755e6ea
Parents: ecfdf8d
Author: Josh Elser <elserj@apache.org>
Authored: Wed Apr 16 19:01:46 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Apr 16 19:11:20 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/data/Key.java | 30 ++++++++++++++++----
 1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e5d10032/core/src/main/java/org/apache/accumulo/core/data/Key.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/data/Key.java b/core/src/main/java/org/apache/accumulo/core/data/Key.java
index bfeb095..f3e87ec 100644
--- a/core/src/main/java/org/apache/accumulo/core/data/Key.java
+++ b/core/src/main/java/org/apache/accumulo/core/data/Key.java
@@ -783,16 +783,20 @@ public class Key implements WritableComparable<Key>, Cloneable
{
     
     return sb;
   }
-  
+
   private StringBuilder rowColumnStringBuilder() {
+    return rowColumnStringBuilder(Constants.MAX_DATA_TO_PRINT);
+  }
+  
+  private StringBuilder rowColumnStringBuilder(int maxComponentLength) {
     StringBuilder sb = new StringBuilder();
-    appendPrintableString(row, 0, row.length, Constants.MAX_DATA_TO_PRINT, sb);
+    appendPrintableString(row, 0, row.length, maxComponentLength, sb);
     sb.append(" ");
-    appendPrintableString(colFamily, 0, colFamily.length, Constants.MAX_DATA_TO_PRINT, sb);
+    appendPrintableString(colFamily, 0, colFamily.length, maxComponentLength, sb);
     sb.append(":");
-    appendPrintableString(colQualifier, 0, colQualifier.length, Constants.MAX_DATA_TO_PRINT,
sb);
+    appendPrintableString(colQualifier, 0, colQualifier.length, maxComponentLength, sb);
     sb.append(" [");
-    appendPrintableString(colVisibility, 0, colVisibility.length, Constants.MAX_DATA_TO_PRINT,
sb);
+    appendPrintableString(colVisibility, 0, colVisibility.length, maxComponentLength, sb);
     sb.append("]");
     return sb;
   }
@@ -806,7 +810,21 @@ public class Key implements WritableComparable<Key>, Cloneable
{
     sb.append(deleted);
     return sb.toString();
   }
-  
+
+  /**
+   * Stringify this {@link Key}, avoiding truncation of each component, only limiting
+   * each component to a length of {@link Integer#MAX_VALUE}
+   * @since 1.7.0
+   */
+  public String toStringNoTruncate() {
+    StringBuilder sb = rowColumnStringBuilder(Integer.MAX_VALUE);
+    sb.append(" ");
+    sb.append(Long.toString(timestamp));
+    sb.append(" ");
+    sb.append(deleted);
+    return sb.toString();
+  }
+
   /**
    * Converts this key to a string, not including timestamp or delete marker.
    *


Mime
View raw message