@Override public String toString() { if (data == null) return null; else return Bytes.toStringBinary(data, offset, length); }
/** * Write a printable representation of a byte array. * * @param b byte array * @return string * @see #toStringBinary(byte[], int, int) */ public static String toStringBinary(final byte[] b) { if (b == null) return "null"; return toStringBinary(b, 0, b.length); }
@Override public String toString() { return Bytes.toStringBinary(key); }
@Override public String toString() { return String.format(Locale.ROOT, "DictNode[root=%s, nodes=%d, firstValue=%s]", Bytes.toStringBinary(part), childrenCount, Bytes.toStringBinary(firstValue())); }
private String toStringBinary(Object value) { if (value == null) return "Null"; byte[] bytes; bytes = value.toString().getBytes(Charset.forName("UTF-8")); return Bytes.toStringBinary(bytes); }
@Override public String toString() { return String.format(Locale.ROOT, "DictSlice[firstValue=%s, values=%d, bytes=%d]", Bytes.toStringBinary(getFirstValue()), nValues, bodyLen); }
/** * Converts the given byte buffer to a printable representation, * from the index 0 (inclusive) to the limit (exclusive), * regardless of the current position. * The position and the other index parameters are not changed. * * @param buf a byte buffer * @return a string representation of the buffer's binary contents * @see #toBytes(ByteBuffer) * @see #getBytes(ByteBuffer) */ public static String toStringBinary(ByteBuffer buf) { if (buf == null) return "null"; if (buf.hasArray()) { return toStringBinary(buf.array(), buf.arrayOffset(), buf.limit()); } return toStringBinary(toBytes(buf)); }
/** * Writes a string as a fixed-size field, padded with zeros. */ public static void writeStringFixedSize(final DataOutput out, String s, int size) throws IOException { byte[] b = toBytes(s); if (b.length > size) { throw new IOException("Trying to write " + b.length + " bytes (" + toStringBinary(b) + ") into a field of length " + size); } out.writeBytes(s); for (int i = 0; i < size - s.length(); ++i) out.writeByte(0); }
protected void logScan(RawScan rawScan, String tableName) { StringBuilder info = new StringBuilder(); info.append("Visiting hbase table ").append(tableName).append(": "); if (cuboid.requirePostAggregation()) { info.append("cuboid require post aggregation, from "); } else { info.append("cuboid exact match, from "); } info.append(cuboid.getInputID()); info.append(" to "); info.append(cuboid.getId()); info.append(" Start: "); info.append(rawScan.getStartKeyAsString()); info.append(" ("); info.append(Bytes.toStringBinary(rawScan.startKey) + ")"); info.append(" Stop: "); info.append(rawScan.getEndKeyAsString()); info.append(" ("); info.append(Bytes.toStringBinary(rawScan.endKey) + ")"); if (rawScan.fuzzyKeys != null && rawScan.fuzzyKeys.size() != 0) { info.append(" Fuzzy key counts: " + rawScan.fuzzyKeys.size()); if (rawScan.fuzzyKeys.size() <= 20) { // avoid logging too many fuzzy keys info.append(". Fuzzy keys : "); info.append(rawScan.getFuzzyKeyAsString()); } } else { info.append(", No Fuzzy Key"); } logger.info(info.toString()); }
return getMinId(); //searching value smaller than the smallest value in dict } else { throw new IllegalArgumentException("Value '" + Bytes.toString(value, offset, len) + "' (" + Bytes.toStringBinary(value, offset, len) + ") not exists!"); index++; if (index >= trees.size()) throw new IllegalArgumentException("Value '" + Bytes.toString(value, offset, len) + "' (" + Bytes.toStringBinary(value, offset, len) + ") not exists!"); int id = tree.getIdFromValueBytesWithoutCache(value, offset, len, roundingFlag); if (id == -1) throw new IllegalArgumentException("Value '" + Bytes.toString(value, offset, len) + "' (" + Bytes.toStringBinary(value, offset, len) + ") not exists!"); id = id + accuOffset.get(index); id += baseId;
for (Result r : scanner) { byte[] rowkey = r.getRow(); System.out.println(Bytes.toStringBinary(rowkey)); count++; if (count == limit)
private int build_writeNode(AppendDictNode n, int offset, boolean isLastChild, int sizeChildOffset, int sizeId, byte[] trieBytes) { int o = offset; // childOffset if (isLastChild) trieBytes[o] |= TrieDictionary.BIT_IS_LAST_CHILD; if (n.isEndOfValue) trieBytes[o] |= TrieDictionary.BIT_IS_END_OF_VALUE; o += sizeChildOffset; // nValueBytes if (n.part.length > 255) throw new RuntimeException( "Value length is " + n.part.length + " and larger than 255: " + Bytes.toStringBinary(n.part)); BytesUtil.writeUnsigned(n.part.length, trieBytes, o, 1); o++; // valueBytes System.arraycopy(n.part, 0, trieBytes, o, n.part.length); o += n.part.length; if (n.isEndOfValue) { checkValidId(n.id); BytesUtil.writeUnsigned(n.id, trieBytes, o, sizeId); o += sizeId; } return o; }
logger.info("start key in binary: {}", Bytes.toStringBinary(startKey)); logger.info("end key in binary: {}", Bytes.toStringBinary(endKey));
BytesUtil.writeUTFString(scanRequest.getStorageBehavior(), out); out.flip(); return Bytes.toStringBinary(out.array(), out.position(), out.limit()); } catch (BufferOverflowException boe) { logger.info("Buffer size {} cannot hold the scan request, resizing to 4 times", scanRequestBufferSize);
@Override public String toString() { if (data == null) return null; else return Bytes.toStringBinary(data, offset, length); }
/** * Write a printable representation of a byte array. * * @param b byte array * @return string * @see #toStringBinary(byte[], int, int) */ public static String toStringBinary(final byte[] b) { if (b == null) return "null"; return toStringBinary(b, 0, b.length); }
/** * Write a printable representation of a byte array. * * @param b byte array * @return string * @see #toStringBinary(byte[], int, int) */ public static String toStringBinary(final byte[] b) { if (b == null) return "null"; return toStringBinary(b, 0, b.length); }
private String toStringBinary(Object value) { if (value == null) return "Null"; byte[] bytes; bytes = value.toString().getBytes(Charset.forName("UTF-8")); return Bytes.toStringBinary(bytes); }
@Override public String toString() { return String.format(Locale.ROOT, "DictSlice[firstValue=%s, values=%d, bytes=%d]", Bytes.toStringBinary(getFirstValue()), nValues, bodyLen); }
/** * Writes a string as a fixed-size field, padded with zeros. */ public static void writeStringFixedSize(final DataOutput out, String s, int size) throws IOException { byte[] b = toBytes(s); if (b.length > size) { throw new IOException("Trying to write " + b.length + " bytes (" + toStringBinary(b) + ") into a field of length " + size); } out.writeBytes(s); for (int i = 0; i < size - s.length(); ++i) out.writeByte(0); }