当前位置: 首页>>代码示例>>Java>>正文


Java ChecksumType.NULL属性代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.ChecksumType.NULL属性的典型用法代码示例。如果您正苦于以下问题:Java ChecksumType.NULL属性的具体用法?Java ChecksumType.NULL怎么用?Java ChecksumType.NULL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.hbase.util.ChecksumType的用法示例。


在下文中一共展示了ChecksumType.NULL属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateChecksums

/**
 * Generates a checksum for all the data in indata. The checksum is
 * written to outdata.
 * @param indata input data stream
 * @param startOffset starting offset in the indata stream from where to
 *                    compute checkums from
 * @param endOffset ending offset in the indata stream upto
 *                   which checksums needs to be computed
 * @param outdata the output buffer where checksum values are written
 * @param outOffset the starting offset in the outdata where the
 *                  checksum values are written
 * @param checksumType type of checksum
 * @param bytesPerChecksum number of bytes per checksum value
 */
static void generateChecksums(byte[] indata, int startOffset, int endOffset,
  byte[] outdata, int outOffset, ChecksumType checksumType,
  int bytesPerChecksum) throws IOException {

  if (checksumType == ChecksumType.NULL) {
    return; // No checksum for this block.
  }

  DataChecksum checksum = DataChecksum.newDataChecksum(
      checksumType.getDataChecksumType(), bytesPerChecksum);

  checksum.calculateChunkedSums(
     ByteBuffer.wrap(indata, startOffset, endOffset - startOffset),
     ByteBuffer.wrap(outdata, outOffset, outdata.length - outOffset));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:ChecksumUtil.java

示例2: convertChecksum

public static ChecksumType convertChecksum(Checksum type) {
  switch (type) {
  case NONE:  return ChecksumType.NULL;
  
  default:
  case CRC32: return ChecksumType.CRC32;
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:8,代码来源:HFileSortedOplogFactory.java

示例3: generateChecksums

/**
 * Generates a checksum for all the data in indata. The checksum is
 * written to outdata.
 * @param indata input data stream
 * @param startOffset starting offset in the indata stream from where to
 *                    compute checkums from
 * @param endOffset ending offset in the indata stream upto
 *                   which checksums needs to be computed
 * @param outData the output buffer where checksum values are written
 * @param outOffset the starting offset in the outdata where the
 *                  checksum values are written
 * @param checksumType type of checksum
 * @param bytesPerChecksum number of bytes per checksum value
 */
static void generateChecksums(byte[] indata,
  int startOffset, int endOffset, 
  byte[] outdata, int outOffset,
  ChecksumType checksumType,
  int bytesPerChecksum) throws IOException {

  if (checksumType == ChecksumType.NULL) {
    return; // No checkums for this block.
  }

  Checksum checksum = checksumType.getChecksumObject();
  int bytesLeft = endOffset - startOffset;
  int chunkNum = 0;

  while (bytesLeft > 0) {
    // generate the checksum for one chunk
    checksum.reset();
    int count = Math.min(bytesLeft, bytesPerChecksum);
    checksum.update(indata, startOffset, count);

    // write the checksum value to the output buffer.
    int cksumValue = (int)checksum.getValue();
    outOffset = Bytes.putInt(outdata, outOffset, cksumValue);
    chunkNum++;
    startOffset += count;
    bytesLeft -= count;
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:42,代码来源:ChecksumUtil.java

示例4: generateChecksums

/**
 * Generates a checksum for all the data in indata. The checksum is
 * written to outdata.
 * @param indata input data stream
 * @param startOffset starting offset in the indata stream from where to
 *                    compute checkums from
 * @param endOffset ending offset in the indata stream upto
 *                   which checksums needs to be computed
 * @param outdata the output buffer where checksum values are written
 * @param outOffset the starting offset in the outdata where the
 *                  checksum values are written
 * @param checksumType type of checksum
 * @param bytesPerChecksum number of bytes per checksum value
 */
static void generateChecksums(byte[] indata,
  int startOffset, int endOffset, 
  byte[] outdata, int outOffset,
  ChecksumType checksumType,
  int bytesPerChecksum) throws IOException {

  if (checksumType == ChecksumType.NULL) {
    return; // No checkums for this block.
  }

  Checksum checksum = checksumType.getChecksumObject();
  int bytesLeft = endOffset - startOffset;
  int chunkNum = 0;

  while (bytesLeft > 0) {
    // generate the checksum for one chunk
    checksum.reset();
    int count = Math.min(bytesLeft, bytesPerChecksum);
    checksum.update(indata, startOffset, count);

    // write the checksum value to the output buffer.
    int cksumValue = (int)checksum.getValue();
    outOffset = Bytes.putInt(outdata, outOffset, cksumValue);
    chunkNum++;
    startOffset += count;
    bytesLeft -= count;
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:42,代码来源:ChecksumUtil.java


注:本文中的org.apache.hadoop.hbase.util.ChecksumType.NULL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。