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


Java ByteBufferUtils.compareTo方法代码示例

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


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

示例1: filterRowKey

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public boolean filterRowKey(Cell firstRowCell) {
  if (firstRowCell == null || this.prefix == null)
    return true;
  if (filterAllRemaining()) return true;
  int length = firstRowCell.getRowLength();
  if (length < prefix.length) return true;
  // if they are equal, return false => pass row
  // else return true, filter row
  // if we are passed the prefix, set flag
  int cmp;
  if (firstRowCell instanceof ByteBufferExtendedCell) {
    cmp = ByteBufferUtils.compareTo(((ByteBufferExtendedCell) firstRowCell).getRowByteBuffer(),
        ((ByteBufferExtendedCell) firstRowCell).getRowPosition(), this.prefix.length,
        this.prefix, 0, this.prefix.length);
  } else {
    cmp = Bytes.compareTo(firstRowCell.getRowArray(), firstRowCell.getRowOffset(),
        this.prefix.length, this.prefix, 0, this.prefix.length);
  }
  if ((!isReversed() && cmp > 0) || (isReversed() && cmp < 0)) {
    passedPrefix = true;
  }
  filterRow = (cmp != 0);
  return filterRow;
}
 
开发者ID:apache,项目名称:hbase,代码行数:26,代码来源:PrefixFilter.java

示例2: equals

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public boolean equals(Object comparison) {
  if (this == comparison) {
    return true;
  }
  if (comparison == null) {
    return false;
  }
  if (comparison.getClass() != this.getClass()) {
    return false;
  }

  HFileBlock castedComparison = (HFileBlock) comparison;

  if (castedComparison.blockType != this.blockType) {
    return false;
  }
  if (castedComparison.nextBlockOnDiskSizeWithHeader != this.nextBlockOnDiskSizeWithHeader) {
    return false;
  }
  if (castedComparison.offset != this.offset) {
    return false;
  }
  if (castedComparison.onDiskSizeWithoutHeader != this.onDiskSizeWithoutHeader) {
    return false;
  }
  if (castedComparison.prevBlockOffset != this.prevBlockOffset) {
    return false;
  }
  if (castedComparison.uncompressedSizeWithoutHeader != this.uncompressedSizeWithoutHeader) {
    return false;
  }
  if (ByteBufferUtils.compareTo(this.buf, 0, this.buf.limit(), castedComparison.buf, 0,
      castedComparison.buf.limit()) != 0) {
    return false;
  }
  return true;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:HFileBlock.java

示例3: compareTo

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public int compareTo(ByteBuffer value, int offset, int length) {
  if (this.value.length <= length) {
    length = this.value.length;
  }
  return ByteBufferUtils.compareTo(this.value, 0, this.value.length, value, offset, length);
}
 
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:BinaryPrefixComparator.java

示例4: compareQualifierPart

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
private static int compareQualifierPart(Cell cell, int length, byte[] prefix) {
  if (cell instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) cell).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) cell).getQualifierPosition(), length, prefix, 0, length);
  }
  return Bytes.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), length, prefix, 0,
      length);
}
 
开发者ID:apache,项目名称:hbase,代码行数:9,代码来源:ColumnPrefixFilter.java

示例5: compareFamilies

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Compare the families of left and right cell
 * @param left
 * @param right
 * @return 0 if both cells are equal, 1 if left cell is bigger than right, -1 otherwise
 */
@Override
public final int compareFamilies(Cell left, Cell right) {
  if (left instanceof ByteBufferExtendedCell && right instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getFamilyByteBuffer(),
        ((ByteBufferExtendedCell) left).getFamilyPosition(), left.getFamilyLength(),
        ((ByteBufferExtendedCell) right).getFamilyByteBuffer(),
        ((ByteBufferExtendedCell) right).getFamilyPosition(), right.getFamilyLength());
  }
  if (left instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getFamilyByteBuffer(),
        ((ByteBufferExtendedCell) left).getFamilyPosition(), left.getFamilyLength(),
        right.getFamilyArray(), right.getFamilyOffset(), right.getFamilyLength());
  }
  if (right instanceof ByteBufferExtendedCell) {
    // Notice how we flip the order of the compare here. We used to negate the return value but
    // see what FindBugs says
    // http://findbugs.sourceforge.net/bugDescriptions.html#RV_NEGATING_RESULT_OF_COMPARETO
    // It suggest flipping the order to get same effect and 'safer'.
    return ByteBufferUtils.compareTo(
        left.getFamilyArray(), left.getFamilyOffset(), left.getFamilyLength(),
        ((ByteBufferExtendedCell)right).getFamilyByteBuffer(),
        ((ByteBufferExtendedCell)right).getFamilyPosition(), right.getFamilyLength());
  }
  return Bytes.compareTo(left.getFamilyArray(), left.getFamilyOffset(), left.getFamilyLength(),
      right.getFamilyArray(), right.getFamilyOffset(), right.getFamilyLength());
}
 
开发者ID:apache,项目名称:hbase,代码行数:33,代码来源:CellComparatorImpl.java

示例6: compareQualifiers

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Compare the qualifiers part of the left and right cells.
 * @param left
 * @param right
 * @return 0 if both cells are equal, 1 if left cell is bigger than right, -1 otherwise
 */
@Override
public final int compareQualifiers(Cell left, Cell right) {
  if (left instanceof ByteBufferExtendedCell && right instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils
        .compareTo(((ByteBufferExtendedCell) left).getQualifierByteBuffer(),
            ((ByteBufferExtendedCell) left).getQualifierPosition(),
            left.getQualifierLength(), ((ByteBufferExtendedCell) right).getQualifierByteBuffer(),
            ((ByteBufferExtendedCell) right).getQualifierPosition(),
            right.getQualifierLength());
  }
  if (left instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) left).getQualifierPosition(), left.getQualifierLength(),
        right.getQualifierArray(), right.getQualifierOffset(), right.getQualifierLength());
  }
  if (right instanceof ByteBufferExtendedCell) {
    // Notice how we flip the order of the compare here. We used to negate the return value but
    // see what FindBugs says
    // http://findbugs.sourceforge.net/bugDescriptions.html#RV_NEGATING_RESULT_OF_COMPARETO
    // It suggest flipping the order to get same effect and 'safer'.
    return ByteBufferUtils.compareTo(left.getQualifierArray(),
        left.getQualifierOffset(), left.getQualifierLength(),
        ((ByteBufferExtendedCell)right).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell)right).getQualifierPosition(), right.getQualifierLength());
  }
  return Bytes.compareTo(left.getQualifierArray(), left.getQualifierOffset(),
      left.getQualifierLength(), right.getQualifierArray(), right.getQualifierOffset(),
      right.getQualifierLength());
}
 
开发者ID:apache,项目名称:hbase,代码行数:36,代码来源:CellComparatorImpl.java

示例7: compareRows

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Compares the rows of the left and right cell.
 * For the hbase:meta case this method is overridden such that it can handle hbase:meta cells.
 * The caller should ensure using the appropriate comparator for hbase:meta.
 * @param left
 * @param right
 * @return 0 if both cells are equal, 1 if left cell is bigger than right, -1 otherwise
 */
@Override
public int compareRows(final Cell left, final Cell right) {
  // left and right can be exactly the same at the beginning of a row
  if (left == right) {
    return 0;
  }
  if (left instanceof ByteBufferExtendedCell && right instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getRowByteBuffer(),
        ((ByteBufferExtendedCell) left).getRowPosition(), left.getRowLength(),
        ((ByteBufferExtendedCell) right).getRowByteBuffer(),
        ((ByteBufferExtendedCell) right).getRowPosition(), right.getRowLength());
  }
  if (left instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getRowByteBuffer(),
        ((ByteBufferExtendedCell) left).getRowPosition(), left.getRowLength(),
        right.getRowArray(), right.getRowOffset(), right.getRowLength());
  }
  if (right instanceof ByteBufferExtendedCell) {
    // Notice how we flip the order of the compare here. We used to negate the return value but
    // see what FindBugs says
    // http://findbugs.sourceforge.net/bugDescriptions.html#RV_NEGATING_RESULT_OF_COMPARETO
    // It suggest flipping the order to get same effect and 'safer'.
    return ByteBufferUtils.compareTo(left.getRowArray(), left.getRowOffset(), left.getRowLength(),
        ((ByteBufferExtendedCell)right).getRowByteBuffer(),
        ((ByteBufferExtendedCell)right).getRowPosition(), right.getRowLength());
  }
  return Bytes.compareTo(left.getRowArray(), left.getRowOffset(), left.getRowLength(),
      right.getRowArray(), right.getRowOffset(), right.getRowLength());
}
 
开发者ID:apache,项目名称:hbase,代码行数:38,代码来源:CellComparatorImpl.java

示例8: matchingValue

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
public static boolean matchingValue(final Cell left, final byte[] buf) {
  if (left instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getValueByteBuffer(),
        ((ByteBufferExtendedCell) left).getValuePosition(), left.getValueLength(), buf, 0,
        buf.length) == 0;
  }
  return Bytes.equals(left.getValueArray(), left.getValueOffset(), left.getValueLength(), buf, 0,
      buf.length);
}
 
开发者ID:apache,项目名称:hbase,代码行数:10,代码来源:CellUtil.java

示例9: compareQualifiers

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Compares the cell's qualifier with the given byte[]
 * @param left the cell for which the qualifier has to be compared
 * @param right the byte[] having the qualifier
 * @param rOffset the offset of the qualifier
 * @param rLength the length of the qualifier
 * @return greater than 0 if left cell's qualifier is bigger than byte[], lesser than 0 if left
 *         cell's qualifier is lesser than byte[] and 0 otherwise
 */
public final static int compareQualifiers(Cell left, byte[] right, int rOffset, int rLength) {
  if (left instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) left).getQualifierPosition(),
        left.getQualifierLength(), right, rOffset, rLength);
  }
  return Bytes.compareTo(left.getQualifierArray(), left.getQualifierOffset(),
    left.getQualifierLength(), right, rOffset, rLength);
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:CellUtil.java

示例10: compareFamilies

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Compares the cell's family with the given byte[]
 * @param left the cell for which the family has to be compared
 * @param right the byte[] having the family
 * @param roffset the offset of the family
 * @param rlength the length of the family
 * @return greater than 0 if left cell's family is bigger than byte[], lesser than 0 if left
 *         cell's family is lesser than byte[] and 0 otherwise
 */
public final static int compareFamilies(Cell left, byte[] right, int roffset, int rlength) {
  if (left instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(((ByteBufferExtendedCell) left).getFamilyByteBuffer(),
      ((ByteBufferExtendedCell) left).getFamilyPosition(), left.getFamilyLength(), right, roffset,
      rlength);
  }
  return Bytes.compareTo(left.getFamilyArray(), left.getFamilyOffset(), left.getFamilyLength(),
    right, roffset, rlength);
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:CellUtil.java

示例11: compareRows

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
private int compareRows(ByteBuffer row, Cell seekCell) {
  if (seekCell instanceof ByteBufferExtendedCell) {
    return ByteBufferUtils.compareTo(row, row.position(), row.remaining(),
        ((ByteBufferExtendedCell) seekCell).getRowByteBuffer(),
        ((ByteBufferExtendedCell) seekCell).getRowPosition(),
        seekCell.getRowLength());
  } else {
    return ByteBufferUtils.compareTo(row, row.position(), row.remaining(),
        seekCell.getRowArray(), seekCell.getRowOffset(),
        seekCell.getRowLength());
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:13,代码来源:RowIndexSeekerV1.java

示例12: compareTo

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public int compareTo(ByteBuffer value, int offset, int length) {
  return ByteBufferUtils.compareTo(this.value, 0, this.value.length, value, offset, length);
}
 
开发者ID:apache,项目名称:hbase,代码行数:5,代码来源:BinaryComparator.java


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