Java 类org.apache.hadoop.hbase.io.SizedCellScanner 实例源码

项目:ditb    文件:TestIPCUtil.java   
static CellScanner getSizedCellScanner(final Cell [] cells) {
  int size = -1;
  for (Cell cell: cells) {
    size += CellUtil.estimatedSerializedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
项目:pbase    文件:TestIPCUtil.java   
static CellScanner getSizedCellScanner(final Cell [] cells) {
  int size = -1;
  for (Cell cell: cells) {
    size += CellUtil.estimatedSerializedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
项目:HIndex    文件:TestIPCUtil.java   
static CellScanner getSizedCellScanner(final Cell [] cells) {
  int size = -1;
  for (Cell cell: cells) {
    size += CellUtil.estimatedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
项目:hbase    文件:TestCellBlockBuilder.java   
static CellScanner getSizedCellScanner(final Cell[] cells) {
  int size = -1;
  for (Cell cell : cells) {
    size += PrivateCellUtil.estimatedSerializedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
项目:PyroDB    文件:TestIPCUtil.java   
static CellScanner getSizedCellScanner(final Cell [] cells) {
  int size = -1;
  for (Cell cell: cells) {
    size += CellUtil.estimatedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
项目:c5    文件:TestIPCUtil.java   
static CellScanner getSizedCellScanner(final Cell [] cells) {
  int size = -1;
  for (Cell cell: cells) {
    size += CellUtil.estimatedSizeOf(cell);
  }
  final int totalSize = ClassSize.align(size);
  final CellScanner cellScanner = CellUtil.createCellScanner(cells);
  return new SizedCellScanner() {
    @Override
    public long heapSize() {
      return totalSize;
    }

    @Override
    public Cell current() {
      return cellScanner.current();
    }

    @Override
    public boolean advance() throws IOException {
      return cellScanner.advance();
    }
  };
}
项目:ditb    文件:ReplicationProtbufUtil.java   
/**
 * @param cells
 * @return <code>cells</code> packaged as a CellScanner
 */
static CellScanner getCellScanner(final List<List<? extends Cell>> cells, final int size) {
  return new SizedCellScanner() {
    private final Iterator<List<? extends Cell>> entries = cells.iterator();
    private Iterator<? extends Cell> currentIterator = null;
    private Cell currentCell;

    @Override
    public Cell current() {
      return this.currentCell;
    }

    @Override
    public boolean advance() {
      if (this.currentIterator == null) {
        if (!this.entries.hasNext()) return false;
        this.currentIterator = this.entries.next().iterator();
      }
      if (this.currentIterator.hasNext()) {
        this.currentCell = this.currentIterator.next();
        return true;
      }
      this.currentCell = null;
      this.currentIterator = null;
      return advance();
    }

    @Override
    public long heapSize() {
      return size;
    }
  };
}
项目:pbase    文件:ReplicationProtbufUtil.java   
/**
 * @param cells
 * @return <code>cells</code> packaged as a CellScanner
 */
static CellScanner getCellScanner(final List<List<? extends Cell>> cells, final int size) {
  return new SizedCellScanner() {
    private final Iterator<List<? extends Cell>> entries = cells.iterator();
    private Iterator<? extends Cell> currentIterator = null;
    private Cell currentCell;

    @Override
    public Cell current() {
      return this.currentCell;
    }

    @Override
    public boolean advance() {
      if (this.currentIterator == null) {
        if (!this.entries.hasNext()) return false;
        this.currentIterator = this.entries.next().iterator();
      }
      if (this.currentIterator.hasNext()) {
        this.currentCell = this.currentIterator.next();
        return true;
      }
      this.currentCell = null;
      this.currentIterator = null;
      return advance();
    }

    @Override
    public long heapSize() {
      return size;
    }
  };
}
项目:HIndex    文件:ReplicationProtbufUtil.java   
/**
 * @param cells
 * @return <code>cells</code> packaged as a CellScanner
 */
static CellScanner getCellScanner(final List<List<? extends Cell>> cells, final int size) {
  return new SizedCellScanner() {
    private final Iterator<List<? extends Cell>> entries = cells.iterator();
    private Iterator<? extends Cell> currentIterator = null;
    private Cell currentCell;

    @Override
    public Cell current() {
      return this.currentCell;
    }

    @Override
    public boolean advance() {
      if (this.currentIterator == null) {
        if (!this.entries.hasNext()) return false;
        this.currentIterator = this.entries.next().iterator();
      }
      if (this.currentIterator.hasNext()) {
        this.currentCell = this.currentIterator.next();
        return true;
      }
      this.currentCell = null;
      this.currentIterator = null;
      return advance();
    }

    @Override
    public long heapSize() {
      return size;
    }
  };
}
项目:hbase    文件:ReplicationProtbufUtil.java   
/**
 * @param cells
 * @return <code>cells</code> packaged as a CellScanner
 */
static CellScanner getCellScanner(final List<List<? extends Cell>> cells, final int size) {
  return new SizedCellScanner() {
    private final Iterator<List<? extends Cell>> entries = cells.iterator();
    private Iterator<? extends Cell> currentIterator = null;
    private Cell currentCell;

    @Override
    public Cell current() {
      return this.currentCell;
    }

    @Override
    public boolean advance() {
      if (this.currentIterator == null) {
        if (!this.entries.hasNext()) return false;
        this.currentIterator = this.entries.next().iterator();
      }
      if (this.currentIterator.hasNext()) {
        this.currentCell = this.currentIterator.next();
        return true;
      }
      this.currentCell = null;
      this.currentIterator = null;
      return advance();
    }

    @Override
    public long heapSize() {
      return size;
    }
  };
}
项目:PyroDB    文件:ReplicationProtbufUtil.java   
/**
 * @param cells
 * @return <code>cells</code> packaged as a CellScanner
 */
static CellScanner getCellScanner(final List<List<? extends Cell>> cells, final int size) {
  return new SizedCellScanner() {
    private final Iterator<List<? extends Cell>> entries = cells.iterator();
    private Iterator<? extends Cell> currentIterator = null;
    private Cell currentCell;

    @Override
    public Cell current() {
      return this.currentCell;
    }

    @Override
    public boolean advance() {
      if (this.currentIterator == null) {
        if (!this.entries.hasNext()) return false;
        this.currentIterator = this.entries.next().iterator();
      }
      if (this.currentIterator.hasNext()) {
        this.currentCell = this.currentIterator.next();
        return true;
      }
      this.currentCell = null;
      this.currentIterator = null;
      return advance();
    }

    @Override
    public long heapSize() {
      return size;
    }
  };
}
项目:c5    文件:ReplicationProtbufUtil.java   
/**
 * @param cells
 * @return <code>cells</code> packaged as a CellScanner
 */
static CellScanner getCellScanner(final List<List<? extends Cell>> cells, final int size) {
  return new SizedCellScanner() {
    private final Iterator<List<? extends Cell>> entries = cells.iterator();
    private Iterator<? extends Cell> currentIterator = null;
    private Cell currentCell;

    @Override
    public Cell current() {
      return this.currentCell;
    }

    @Override
    public boolean advance() {
      if (this.currentIterator == null) {
        if (!this.entries.hasNext()) return false;
        this.currentIterator = this.entries.next().iterator();
      }
      if (this.currentIterator.hasNext()) {
        this.currentCell = this.currentIterator.next();
        return true;
      }
      this.currentCell = null;
      this.currentIterator = null;
      return advance();
    }

    @Override
    public long heapSize() {
      return size;
    }
  };
}