co.cask.cdap.api.common.Bytes.toHexString()方法的使用及代码示例

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

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

Bytes.toHexString介绍

[英]Returns a string containing each byte, in order, as a two-digit unsigned hexadecimal number in lower case.
[中]按顺序返回包含每个字节的字符串,该字符串以两位无符号十六进制数(小写)表示。

代码示例

代码示例来源:origin: caskdata/cdap

@Override
public String getId() {
 return Bytes.toHexString(rawMessage.getId());
}

代码示例来源:origin: co.cask.cdap/cdap-tms

@Override
public String getId() {
 return Bytes.toHexString(rawMessage.getId());
}

代码示例来源:origin: co.cask.cdap/cdap-formats

@Override
protected void configure(Map<String, String> settings) {
 try {
  // Not using guava Hashing.md5() here to avoid potential version conflict issue when used in Hive
  MessageDigest md5 = MessageDigest.getInstance("MD5");
  // Before actually reading any event, we assume the event schema is the same as the format schema
  formatSchemaHash = Bytes.toHexString(md5.digest(Bytes.toBytes(avroFormatSchema.toString())));
  eventSchemaHash = formatSchemaHash;
  datumReader = new StructuredRecordDatumReader(formatSchema, avroFormatSchema);
 } catch (NoSuchAlgorithmException e) {
  // This shouldn't happen.
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: caskdata/cdap

@Override
public String toString() {
 return Objects.toStringHelper(this)
  .add("programRunId", getProgramRunId())
  .add("startTs", getStartTs())
  .add("runTs", getRunTs())
  .add("stopTs", getStopTs())
  .add("suspendTs", getSuspendTs())
  .add("resumeTs", getResumeTs())
  .add("status", getStatus())
  .add("twillrunid", getTwillRunId())
  .add("properties", getProperties())
  .add("sourceId", getSourceId() == null ? null : Bytes.toHexString(getSourceId()))
  .add("artifactId", getArtifactId() == null ? null : getArtifactId())
  .add("principal", getPrincipal() == null ? null : getPrincipal())
  .toString();
}

代码示例来源:origin: co.cask.cdap/cdap-common

@Override
public String toString() {
 return Objects.toStringHelper(this)
  .add("programRunId", getProgramRunId())
  .add("startTs", getStartTs())
  .add("runTs", getRunTs())
  .add("stopTs", getStopTs())
  .add("suspendTs", getSuspendTs())
  .add("resumeTs", getResumeTs())
  .add("status", getStatus())
  .add("twillrunid", getTwillRunId())
  .add("properties", getProperties())
  .add("sourceId", getSourceId() == null ? null : Bytes.toHexString(getSourceId()))
  .add("artifactId", getArtifactId() == null ? null : getArtifactId())
  .add("principal", getPrincipal() == null ? null : getPrincipal())
  .toString();
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

private Scanner getScanner(FactScan scan) {
 // sort the measures based on their entity ids and based on that get the start and end row key metric names
 List<String> measureNames = getSortedMeasures(scan.getMeasureNames());
 byte[] startRow = codec.createStartRowKey(scan.getDimensionValues(),
                      measureNames.isEmpty() ? null : measureNames.get(0),
                      scan.getStartTs(), false);
 byte[] endRow = codec.createEndRowKey(scan.getDimensionValues(),
                    measureNames.isEmpty() ? null : measureNames.get(measureNames.size() - 1),
                    scan.getEndTs(), false);
 byte[][] columns;
 if (Arrays.equals(startRow, endRow)) {
  // If on the same timebase, we only need subset of columns
  long timeBase = scan.getStartTs() / rollTime * rollTime;
  int startCol = (int) (scan.getStartTs() - timeBase) / resolution;
  int endCol = (int) (scan.getEndTs() - timeBase) / resolution;
  columns = new byte[endCol - startCol + 1][];
  for (int i = 0; i < columns.length; i++) {
   columns[i] = Bytes.toBytes((short) (startCol + i));
  }
 }
 endRow = Bytes.stopKeyForPrefix(endRow);
 FuzzyRowFilter fuzzyRowFilter =
  measureNames.isEmpty() ? createFuzzyRowFilter(scan, startRow) : createFuzzyRowFilter(scan, measureNames);
 if (LOG.isTraceEnabled()) {
  LOG.trace("Scanning fact table {} with scan: {}; constructed startRow: {}, endRow: {}, fuzzyRowFilter: {}",
       timeSeriesTable, scan, Bytes.toHexString(startRow),
       endRow == null ? null : Bytes.toHexString(endRow), fuzzyRowFilter);
 }
 return timeSeriesTable.scan(startRow, endRow, fuzzyRowFilter);
}

代码示例来源:origin: cdapio/cdap

private Scanner getScanner(FactScan scan) {
 // sort the measures based on their entity ids and based on that get the start and end row key metric names
 List<String> measureNames = getSortedMeasures(scan.getMeasureNames());
 byte[] startRow = codec.createStartRowKey(scan.getDimensionValues(),
                      measureNames.isEmpty() ? null : measureNames.get(0),
                      scan.getStartTs(), false);
 byte[] endRow = codec.createEndRowKey(scan.getDimensionValues(),
                    measureNames.isEmpty() ? null : measureNames.get(measureNames.size() - 1),
                    scan.getEndTs(), false);
 byte[][] columns;
 if (Arrays.equals(startRow, endRow)) {
  // If on the same timebase, we only need subset of columns
  long timeBase = scan.getStartTs() / rollTime * rollTime;
  int startCol = (int) (scan.getStartTs() - timeBase) / resolution;
  int endCol = (int) (scan.getEndTs() - timeBase) / resolution;
  columns = new byte[endCol - startCol + 1][];
  for (int i = 0; i < columns.length; i++) {
   columns[i] = Bytes.toBytes((short) (startCol + i));
  }
 }
 endRow = Bytes.stopKeyForPrefix(endRow);
 FuzzyRowFilter fuzzyRowFilter =
  measureNames.isEmpty() ? createFuzzyRowFilter(scan, startRow) : createFuzzyRowFilter(scan, measureNames);
 if (LOG.isTraceEnabled()) {
  LOG.trace("Scanning fact table {} with scan: {}; constructed startRow: {}, endRow: {}, fuzzyRowFilter: {}",
       timeSeriesTable, scan, Bytes.toHexString(startRow),
       endRow == null ? null : Bytes.toHexString(endRow), fuzzyRowFilter);
 }
 return timeSeriesTable.scan(startRow, endRow, fuzzyRowFilter);
}

代码示例来源:origin: co.cask.cdap/cdap-app-fabric

LOG.debug("Current source id '{}' is not larger than the existing source id '{}' in the existing " +
      "run record meta '{}'. Skip recording state transition to program state {} and cluster state {}.",
     Bytes.toHexString(sourceId), Bytes.toHexString(existingSourceId), existing,
     nextProgramState, nextClusterState);
return false;

代码示例来源:origin: cdapio/cdap

LOG.debug("Current source id '{}' is not larger than the existing source id '{}' in the existing " +
      "run record meta '{}'. Skip recording state transition to program state {} and cluster state {}.",
     Bytes.toHexString(sourceId), Bytes.toHexString(existingSourceId), existing,
     nextProgramState, nextClusterState);
return false;

相关文章