protected StringBuilder appendText(StringBuilder sb, Text t) { return appendBytes(sb, t.getBytes(), 0, t.getLength()); }
public String formatEntry(Key key, Status status, DateFormat timestampFormat) { StringBuilder sb = new StringBuilder(); Text buffer = new Text(); // append row key.getRow(buffer); appendText(sb, buffer).append(" "); // append column family key.getColumnFamily(buffer); appendText(sb, buffer).append(":"); // append column qualifier key.getColumnQualifier(buffer); appendText(sb, buffer).append(" "); // append visibility expression key.getColumnVisibility(buffer); sb.append(new ColumnVisibility(buffer)); // append timestamp if (timestampFormat != null) { tmpDate.get().setTime(key.getTimestamp()); sb.append(" ").append(timestampFormat.format(tmpDate.get())); } sb.append("\t"); // append value if (status != null) { sb.append(ProtobufUtil.toString(status)); } else { sb.append("Could not deserialize Status protocol buffer"); } return sb.toString(); }
@Override public String next() { Entry<Key,Value> entry = iterator.next(); DateFormat timestampFormat = config.willPrintTimestamps() ? config.getDateFormatSupplier().get() : null; // If we expected this to be a protobuf, try to parse it, adding a message when it fails to // parse if (REPLICATION_COLFAMS.contains(entry.getKey().getColumnFamily())) { Status status; try { status = Status.parseFrom(entry.getValue().get()); } catch (InvalidProtocolBufferException e) { log.trace("Could not deserialize protocol buffer for {}", entry.getKey(), e); status = null; } return formatEntry(entry.getKey(), status, timestampFormat); } else { // Otherwise, we're set on a table that contains other data too (e.g. accumulo.metadata) // Just do the normal thing return DefaultFormatter.formatEntry(entry, timestampFormat); } }
protected StringBuilder appendText(StringBuilder sb, Text t) { return appendBytes(sb, t.getBytes(), 0, t.getLength()); }
@Override public String next() { Entry<Key,Value> entry = iterator.next(); DateFormat timestampFormat = config.willPrintTimestamps() ? config.getDateFormatSupplier().get() : null; // If we expected this to be a protobuf, try to parse it, adding a message when it fails to // parse if (REPLICATION_COLFAMS.contains(entry.getKey().getColumnFamily())) { Status status; try { status = Status.parseFrom(entry.getValue().get()); } catch (InvalidProtocolBufferException e) { log.trace("Could not deserialize protocol buffer for {}", entry.getKey(), e); status = null; } return formatEntry(entry.getKey(), status, timestampFormat); } else { // Otherwise, we're set on a table that contains other data too (e.g. accumulo.metadata) // Just do the normal thing return DefaultFormatter.formatEntry(entry, timestampFormat); } }
public String formatEntry(Key key, Status status, DateFormat timestampFormat) { StringBuilder sb = new StringBuilder(); Text buffer = new Text(); // append row key.getRow(buffer); appendText(sb, buffer).append(" "); // append column family key.getColumnFamily(buffer); appendText(sb, buffer).append(":"); // append column qualifier key.getColumnQualifier(buffer); appendText(sb, buffer).append(" "); // append visibility expression key.getColumnVisibility(buffer); sb.append(new ColumnVisibility(buffer)); // append timestamp if (timestampFormat != null) { tmpDate.get().setTime(key.getTimestamp()); sb.append(" ").append(timestampFormat.format(tmpDate.get())); } sb.append("\t"); // append value if (status != null) { sb.append(ProtobufUtil.toString(status)); } else { sb.append("Could not deserialize Status protocol buffer"); } return sb.toString(); }