當前位置: 首頁>>代碼示例>>Java>>正文


Java Cell.toString方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.Cell.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Cell.toString方法的具體用法?Java Cell.toString怎麽用?Java Cell.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.Cell的用法示例。


在下文中一共展示了Cell.toString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addDeleteMarker

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
/**
 * Advanced use only.
 * Add an existing delete marker to this Delete object.
 * @param kv An existing KeyValue of type "delete".
 * @return this for invocation chaining
 * @throws IOException
 */
@SuppressWarnings("unchecked")
public Delete addDeleteMarker(Cell kv) throws IOException {
  // TODO: Deprecate and rename 'add' so it matches how we add KVs to Puts.
  if (!CellUtil.isDelete(kv)) {
    throw new IOException("The recently added KeyValue is not of type "
        + "delete. Rowkey: " + Bytes.toStringBinary(this.row));
  }
  if (Bytes.compareTo(this.row, 0, row.length, kv.getRowArray(),
      kv.getRowOffset(), kv.getRowLength()) != 0) {
    throw new WrongRowIOException("The row in " + kv.toString() +
      " doesn't match the original one " +  Bytes.toStringBinary(this.row));
  }
  byte [] family = CellUtil.cloneFamily(kv);
  List<Cell> list = familyMap.get(family);
  if (list == null) {
    list = new ArrayList<Cell>();
  }
  list.add(kv);
  familyMap.put(family, list);
  return this;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:29,代碼來源:Delete.java

示例2: doSmokeTest

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
public static void doSmokeTest(FileSystem fs, Path path, String codec)
throws Exception {
  Configuration conf = HBaseConfiguration.create();
  HFileContext context = new HFileContextBuilder()
                         .withCompression(AbstractHFileWriter.compressionByName(codec)).build();
  HFile.Writer writer = HFile.getWriterFactoryNoCache(conf)
      .withPath(fs, path)
      .withFileContext(context)
      .create();
  // Write any-old Cell...
  final byte [] rowKey = Bytes.toBytes("compressiontestkey");
  Cell c = CellUtil.createCell(rowKey, Bytes.toBytes("compressiontestval"));
  writer.append(c);
  writer.appendFileInfo(Bytes.toBytes("compressioninfokey"), Bytes.toBytes("compressioninfoval"));
  writer.close();
  Cell cc = null;
  HFile.Reader reader = HFile.createReader(fs, path, new CacheConfig(conf), conf);
  try {
    reader.loadFileInfo();
    HFileScanner scanner = reader.getScanner(false, true);
    scanner.seekTo(); // position to the start of file
    // Scanner does not do Cells yet. Do below for now till fixed.
    cc = scanner.getKeyValue();
    if (CellComparator.compareRows(c, cc) != 0) {
      throw new Exception("Read back incorrect result: " + c.toString() + " vs " + cc.toString());
    }
  } finally {
    reader.close();
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:CompressionTest.java

示例3: add

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
/**
 * Add the specified KeyValue to this Put operation.  Operation assumes that
 * the passed KeyValue is immutable and its backing array will not be modified
 * for the duration of this Put.
 * @param kv individual KeyValue
 * @return this
 * @throws java.io.IOException e
 */
public Put add(Cell kv) throws IOException{
  byte [] family = CellUtil.cloneFamily(kv);
  List<Cell> list = getCellList(family);
  //Checking that the row of the kv is the same as the put
  int res = Bytes.compareTo(this.row, 0, row.length,
      kv.getRowArray(), kv.getRowOffset(), kv.getRowLength());
  if (res != 0) {
    throw new WrongRowIOException("The row in " + kv.toString() +
      " doesn't match the original one " +  Bytes.toStringBinary(this.row));
  }
  list.add(kv);
  familyMap.put(family, list);
  return this;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:Put.java


注:本文中的org.apache.hadoop.hbase.Cell.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。