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


Java CellProtos类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.CellProtos的典型用法代码示例。如果您正苦于以下问题:Java CellProtos类的具体用法?Java CellProtos怎么用?Java CellProtos使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: write

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
@Override
public void write(Cell cell) throws IOException {
  checkFlushed();
  CellProtos.Cell.Builder builder = CellProtos.Cell.newBuilder();
  // This copies bytes from Cell to ByteString.  I don't see anyway around the copy.
  // ByteString is final.
  builder.setRow(ByteStringer.wrap(cell.getRowArray(), cell.getRowOffset(),
      cell.getRowLength()));
  builder.setFamily(ByteStringer.wrap(cell.getFamilyArray(), cell.getFamilyOffset(),
      cell.getFamilyLength()));
  builder.setQualifier(ByteStringer.wrap(cell.getQualifierArray(),
      cell.getQualifierOffset(), cell.getQualifierLength()));
  builder.setTimestamp(cell.getTimestamp());
  builder.setCellType(CellProtos.CellType.valueOf(cell.getTypeByte()));
  builder.setValue(ByteStringer.wrap(cell.getValueArray(), cell.getValueOffset(),
      cell.getValueLength()));
  CellProtos.Cell pbcell = builder.build();
  pbcell.writeDelimitedTo(this.out);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:MessageCodec.java

示例2: toResult

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
/**
 * Convert a protocol buffer Result to a client Result
 *
 * @param proto the protocol buffer Result to convert
 * @return the converted client Result
 */
public static Result toResult(final ClientProtos.Result proto) {
  if (proto.hasExists()) {
    if (proto.getStale()) {
      return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE_STALE :EMPTY_RESULT_EXISTS_FALSE_STALE;
    }
    return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE : EMPTY_RESULT_EXISTS_FALSE;
  }

  List<CellProtos.Cell> values = proto.getCellList();
  if (values.isEmpty()){
    return proto.getStale() ? EMPTY_RESULT_STALE : EMPTY_RESULT;
  }

  List<Cell> cells = new ArrayList<Cell>(values.size());
  for (CellProtos.Cell c : values) {
    cells.add(toCell(c));
  }
  return Result.create(cells, null, proto.getStale(), proto.getPartial());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:ProtobufUtil.java

示例3: toCell

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
public static CellProtos.Cell toCell(final Cell kv) {
  // Doing this is going to kill us if we do it for all data passed.
  // St.Ack 20121205
  CellProtos.Cell.Builder kvbuilder = CellProtos.Cell.newBuilder();
  kvbuilder.setRow(ByteStringer.wrap(kv.getRowArray(), kv.getRowOffset(),
      kv.getRowLength()));
  kvbuilder.setFamily(ByteStringer.wrap(kv.getFamilyArray(),
      kv.getFamilyOffset(), kv.getFamilyLength()));
  kvbuilder.setQualifier(ByteStringer.wrap(kv.getQualifierArray(),
      kv.getQualifierOffset(), kv.getQualifierLength()));
  kvbuilder.setCellType(CellProtos.CellType.valueOf(kv.getTypeByte()));
  kvbuilder.setTimestamp(kv.getTimestamp());
  kvbuilder.setValue(ByteStringer.wrap(kv.getValueArray(), kv.getValueOffset(),
      kv.getValueLength()));
  return kvbuilder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:ProtobufUtil.java

示例4: apply

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
@Override
public HRow apply(byte[] rowkey, List<Cell> cells) {

    Preconditions.checkNotNull(rowkey);
    Preconditions.checkNotNull(cells);
    final List<HRow.HColumn> columns = toRowColumns(cells);
    HRow.RowOp rowOp = null;
    final Cell cell = cells.get(0);
    final CellProtos.CellType type = CellProtos.CellType.valueOf(cell.getTypeByte());
    switch (type) {
        case DELETE:
        case DELETE_COLUMN:
        case DELETE_FAMILY:
            rowOp = HRow.RowOp.DELETE;
            break;
        case PUT:
            rowOp = HRow.RowOp.PUT;
            break;
    }
    final HRow row = new HRow(rowkey, rowOp, columns);
    return row;
}
 
开发者ID:mravi,项目名称:hbase-connect-kafka,代码行数:23,代码来源:ToHRowFunction.java

示例5: toResult

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
/**
 * Convert a protocol buffer Result to a client Result
 *
 * @param proto the protocol buffer Result to convert
 * @return the converted client Result
 */
public static Result toResult(final ClientProtos.Result proto) {
  if (proto.hasExists()) {
    if (proto.getStale()) {
      return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE_STALE :EMPTY_RESULT_EXISTS_FALSE_STALE;
    }
    return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE : EMPTY_RESULT_EXISTS_FALSE;
  }

  List<CellProtos.Cell> values = proto.getCellList();
  if (values.isEmpty()){
    return proto.getStale() ? EMPTY_RESULT_STALE : EMPTY_RESULT;
  }

  List<Cell> cells = new ArrayList<Cell>(values.size());
  for (CellProtos.Cell c : values) {
    cells.add(toCell(c));
  }
  return Result.create(cells, null, proto.getStale());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:26,代码来源:ProtobufUtil.java

示例6: write

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
@Override
public void write(Cell cell) throws IOException {
  checkFlushed();
  CellProtos.Cell.Builder builder = CellProtos.Cell.newBuilder();
  // This copies bytes from Cell to ByteString.  I don't see anyway around the copy.
  // ByteString is final.
  builder.setRow(HBaseZeroCopyByteString.wrap(cell.getRowArray(), cell.getRowOffset(),
      cell.getRowLength()));
  builder.setFamily(HBaseZeroCopyByteString.wrap(cell.getFamilyArray(), cell.getFamilyOffset(),
      cell.getFamilyLength()));
  builder.setQualifier(HBaseZeroCopyByteString.wrap(cell.getQualifierArray(),
      cell.getQualifierOffset(), cell.getQualifierLength()));
  builder.setTimestamp(cell.getTimestamp());
  builder.setCellType(CellProtos.CellType.valueOf(cell.getTypeByte()));
  builder.setValue(HBaseZeroCopyByteString.wrap(cell.getValueArray(), cell.getValueOffset(),
      cell.getValueLength()));
  CellProtos.Cell pbcell = builder.build();
  pbcell.writeDelimitedTo(this.out);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:20,代码来源:MessageCodec.java

示例7: toResult

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
/**
 * Convert a protocol buffer Result to a client Result
 *
 * @param proto the protocol buffer Result to convert
 * @return the converted client Result
 */
public static Result toResult(final ClientProtos.Result proto) {
  if (proto.hasExists()) {
    return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE : EMPTY_RESULT_EXISTS_FALSE;
  }

  List<CellProtos.Cell> values = proto.getCellList();
  if (values.isEmpty()){
    return EMPTY_RESULT;
  }

  List<Cell> cells = new ArrayList<Cell>(values.size());
  for (CellProtos.Cell c : values) {
    cells.add(toCell(c));
  }
  return Result.create(cells, null);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:23,代码来源:ProtobufUtil.java

示例8: toCell

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
public static CellProtos.Cell toCell(final Cell kv) {
  // Doing this is going to kill us if we do it for all data passed.
  // St.Ack 20121205
  CellProtos.Cell.Builder kvbuilder = CellProtos.Cell.newBuilder();
  kvbuilder.setRow(HBaseZeroCopyByteString.wrap(kv.getRowArray(), kv.getRowOffset(),
      kv.getRowLength()));
  kvbuilder.setFamily(HBaseZeroCopyByteString.wrap(kv.getFamilyArray(),
      kv.getFamilyOffset(), kv.getFamilyLength()));
  kvbuilder.setQualifier(HBaseZeroCopyByteString.wrap(kv.getQualifierArray(),
      kv.getQualifierOffset(), kv.getQualifierLength()));
  kvbuilder.setCellType(CellProtos.CellType.valueOf(kv.getTypeByte()));
  kvbuilder.setTimestamp(kv.getTimestamp());
  kvbuilder.setValue(HBaseZeroCopyByteString.wrap(kv.getValueArray(), kv.getValueOffset(),
      kv.getValueLength()));
  return kvbuilder.build();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:ProtobufUtil.java

示例9: testToCell

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
@Test
public void testToCell() throws Exception {
  KeyValue kv1 =
      new KeyValue(Bytes.toBytes("aaa"), Bytes.toBytes("f1"), Bytes.toBytes("q1"), new byte[30]);
  KeyValue kv2 =
      new KeyValue(Bytes.toBytes("bbb"), Bytes.toBytes("f1"), Bytes.toBytes("q1"), new byte[30]);
  KeyValue kv3 =
      new KeyValue(Bytes.toBytes("ccc"), Bytes.toBytes("f1"), Bytes.toBytes("q1"), new byte[30]);
  byte[] arr = new byte[kv1.getLength() + kv2.getLength() + kv3.getLength()];
  System.arraycopy(kv1.getBuffer(), kv1.getOffset(), arr, 0, kv1.getLength());
  System.arraycopy(kv2.getBuffer(), kv2.getOffset(), arr, kv1.getLength(), kv2.getLength());
  System.arraycopy(kv3.getBuffer(), kv3.getOffset(), arr, kv1.getLength() + kv2.getLength(),
    kv3.getLength());
  ByteBuffer dbb = ByteBuffer.allocateDirect(arr.length);
  dbb.put(arr);
  ByteBufferKeyValue offheapKV = new ByteBufferKeyValue(dbb, kv1.getLength(), kv2.getLength());
  CellProtos.Cell cell = ProtobufUtil.toCell(offheapKV);
  Cell newOffheapKV =
      ProtobufUtil.toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), cell);
  assertTrue(CellComparatorImpl.COMPARATOR.compare(offheapKV, newOffheapKV) == 0);
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestProtobufUtil.java

示例10: toResult

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
/**
 * Convert a protocol buffer Result to a client Result
 *
 * @param proto the protocol buffer Result to convert
 * @return the converted client Result
 */
public static Result toResult(final ClientProtos.Result proto) {
  if (proto.hasExists()) {
    if (proto.getStale()) {
      return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE_STALE :EMPTY_RESULT_EXISTS_FALSE_STALE;
    }
    return proto.getExists() ? EMPTY_RESULT_EXISTS_TRUE : EMPTY_RESULT_EXISTS_FALSE;
  }

  List<CellProtos.Cell> values = proto.getCellList();
  if (values.isEmpty()){
    return proto.getStale() ? EMPTY_RESULT_STALE : EMPTY_RESULT;
  }

  List<Cell> cells = new ArrayList<>(values.size());
  ExtendedCellBuilder builder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
  for (CellProtos.Cell c : values) {
    cells.add(toCell(builder, c));
  }
  return Result.create(cells, null, proto.getStale(), proto.getPartial());
}
 
开发者ID:apache,项目名称:hbase,代码行数:27,代码来源:ProtobufUtil.java

示例11: write

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
@Override
public void write(Cell cell) throws IOException {
  checkFlushed();
  CellProtos.Cell.Builder builder = CellProtos.Cell.newBuilder();
  // This copies bytes from Cell to ByteString.  I don't see anyway around the copy.
  // ByteString is final.
  builder.setRow(ByteString.copyFrom(cell.getRowArray(), cell.getRowOffset(),
      cell.getRowLength()));
  builder.setFamily(ByteString.copyFrom(cell.getFamilyArray(), cell.getFamilyOffset(),
      cell.getFamilyLength()));
  builder.setQualifier(ByteString.copyFrom(cell.getQualifierArray(), cell.getQualifierOffset(),
      cell.getQualifierLength()));
  builder.setTimestamp(cell.getTimestamp());
  builder.setCellType(CellProtos.CellType.valueOf(cell.getTypeByte()));
  builder.setValue(ByteString.copyFrom(cell.getValueArray(), cell.getValueOffset(),
      cell.getValueLength()));
  CellProtos.Cell pbcell = builder.build();
  pbcell.writeDelimitedTo(this.out);
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:20,代码来源:MessageCodec.java

示例12: toCell

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
public static CellProtos.Cell toCell(final Cell kv) {
  // Doing this is going to kill us if we do it for all data passed.
  // St.Ack 20121205
  CellProtos.Cell.Builder kvbuilder = CellProtos.Cell.newBuilder();
  kvbuilder.setRow(ZeroCopyLiteralByteString.wrap(kv.getRowArray(), kv.getRowOffset(),
    kv.getRowLength()));
  kvbuilder.setFamily(ZeroCopyLiteralByteString.wrap(kv.getFamilyArray(),
    kv.getFamilyOffset(), kv.getFamilyLength()));
  kvbuilder.setQualifier(ZeroCopyLiteralByteString.wrap(kv.getQualifierArray(),
    kv.getQualifierOffset(), kv.getQualifierLength()));
  kvbuilder.setCellType(CellProtos.CellType.valueOf(kv.getTypeByte()));
  kvbuilder.setTimestamp(kv.getTimestamp());
  kvbuilder.setValue(ZeroCopyLiteralByteString.wrap(kv.getValueArray(), kv.getValueOffset(),
    kv.getValueLength()));
  return kvbuilder.build();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:17,代码来源:ProtobufUtil.java

示例13: parseCell

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
protected Cell parseCell() throws IOException {
  CellProtos.Cell pbcell = CellProtos.Cell.parseDelimitedFrom(this.in);
  return CellUtil.createCell(pbcell.getRow().toByteArray(),
    pbcell.getFamily().toByteArray(), pbcell.getQualifier().toByteArray(),
    pbcell.getTimestamp(), (byte)pbcell.getCellType().getNumber(),
    pbcell.getValue().toByteArray());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:MessageCodec.java

示例14: getBaseCellBuilder

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
static CellProtos.Cell.Builder getBaseCellBuilder(final ByteString row) {
  CellProtos.Cell.Builder cellBuilder = CellProtos.Cell.newBuilder();
  cellBuilder.setRow(row);
  cellBuilder.setFamily(CATALOG_FAMILY_BYTESTRING);
  cellBuilder.setTimestamp(System.currentTimeMillis());
  return cellBuilder;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestClientNoCluster.java

示例15: getStartCode

import org.apache.hadoop.hbase.protobuf.generated.CellProtos; //导入依赖的package包/类
static CellProtos.Cell getStartCode(final ByteString row) {
  CellProtos.Cell.Builder cellBuilder = getBaseCellBuilder(row);
  cellBuilder.setQualifier(ByteStringer.wrap(HConstants.STARTCODE_QUALIFIER));
  // TODO:
  cellBuilder.setValue(ByteStringer.wrap(Bytes.toBytes(META_SERVERNAME.getStartcode())));
  return cellBuilder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:TestClientNoCluster.java


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