org.apache.kylin.common.util.Bytes.toStringBinary()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(207)

本文整理了Java中org.apache.kylin.common.util.Bytes.toStringBinary()方法的一些代码示例,展示了Bytes.toStringBinary()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.toStringBinary()方法的具体详情如下:
包路径:org.apache.kylin.common.util.Bytes
类名称:Bytes
方法名:toStringBinary

Bytes.toStringBinary介绍

[英]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.
[中]

代码示例

代码示例来源:origin: apache/kylin

@Override
public String toString() {
  if (data == null)
    return null;
  else
    return Bytes.toStringBinary(data, offset, length);
}

代码示例来源:origin: apache/kylin

/**
 * 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);
}

代码示例来源:origin: apache/kylin

@Override
public String toString() {
  return Bytes.toStringBinary(key);
}

代码示例来源:origin: apache/kylin

@Override
public String toString() {
  return String.format(Locale.ROOT, "DictNode[root=%s, nodes=%d, firstValue=%s]", Bytes.toStringBinary(part),
      childrenCount, Bytes.toStringBinary(firstValue()));
}

代码示例来源:origin: apache/kylin

private String toStringBinary(Object value) {
  if (value == null)
    return "Null";
  byte[] bytes;
  bytes = value.toString().getBytes(Charset.forName("UTF-8"));
  return Bytes.toStringBinary(bytes);
}

代码示例来源:origin: apache/kylin

@Override
public String toString() {
  return String.format(Locale.ROOT, "DictSlice[firstValue=%s, values=%d, bytes=%d]",
      Bytes.toStringBinary(getFirstValue()), nValues, bodyLen);
}

代码示例来源:origin: apache/kylin

/**
 * 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));
}

代码示例来源:origin: apache/kylin

/**
 * 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);
}

代码示例来源:origin: apache/kylin

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());
}

代码示例来源:origin: apache/kylin

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;

代码示例来源:origin: apache/kylin

for (Result r : scanner) {
  byte[] rowkey = r.getRow();
  System.out.println(Bytes.toStringBinary(rowkey));
  count++;
  if (count == limit)

代码示例来源:origin: apache/kylin

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;
}

代码示例来源:origin: apache/kylin

logger.info("start key in binary: {}", Bytes.toStringBinary(startKey));
logger.info("end key in binary: {}", Bytes.toStringBinary(endKey));

代码示例来源:origin: apache/kylin

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);

代码示例来源:origin: org.apache.kylin/kylin-core-common

@Override
public String toString() {
  if (data == null)
    return null;
  else
    return Bytes.toStringBinary(data, offset, length);
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * 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);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * 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);
}

代码示例来源:origin: org.apache.kylin/kylin-core-cube

private String toStringBinary(Object value) {
  if (value == null)
    return "Null";
  byte[] bytes;
  bytes = value.toString().getBytes(Charset.forName("UTF-8"));
  return Bytes.toStringBinary(bytes);
}

代码示例来源:origin: org.apache.kylin/kylin-core-dictionary

@Override
public String toString() {
  return String.format(Locale.ROOT, "DictSlice[firstValue=%s, values=%d, bytes=%d]",
      Bytes.toStringBinary(getFirstValue()), nValues, bodyLen);
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * 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);
}

相关文章