예제 #1
0
  /** Returns the following block. */
  public boolean nextBlock() throws IOException {
    byte[] buffer = _buffer;

    Block block = _block;
    _block = null;
    _buffer = null;

    if (block != null) {
      block.free();
    }

    _blockId = _table.firstRowBlock(_blockId + Table.BLOCK_SIZE);

    if (_blockId < 0) {
      return false;
    }

    block = _xa.readBlock(_table, _blockId);

    buffer = block.getBuffer();
    _block = block;
    _buffer = buffer;
    _rowOffset = 0;

    return true;
  }
예제 #2
0
  /** Sets the next row. */
  public void setRow(long rowAddr) throws IOException {
    long blockId = _table.addressToBlockId(rowAddr);

    if (blockId != _blockId) {
      _blockId = blockId;

      Block block = _block;
      _block = null;
      _buffer = null;

      if (block != null) {
        block.free();
      }

      _block = _xa.readBlock(_table, _blockId);
      _buffer = _block.getBuffer();
    }

    _rowOffset = (int) (rowAddr & BlockStore.BLOCK_OFFSET_MASK);
  }