public SSTableSliceIterator( SSTableReader sstable, DecoratedKey key, ByteBuffer startColumn, ByteBuffer finishColumn, boolean reversed) { this.key = key; fileToClose = sstable.getFileDataInput(this.key, NodeDescriptor.getSlicedReadBufferSizeInKB() * 1024); if (fileToClose == null) return; try { DecoratedKey keyInDisk = SSTableReader.decodeKey( sstable.partitioner, sstable.descriptor, ByteBufferUtil.readWithShortLength(fileToClose)); assert keyInDisk.equals(key) : String.format("%s != %s in %s", keyInDisk, key, fileToClose.getPath()); SSTableReader.readRowSize(fileToClose, sstable.descriptor); } catch (IOException e) { throw new IOError(e); } reader = createReader(sstable, fileToClose, startColumn, finishColumn, reversed); }
public void close() throws IOException { if (fileToClose != null) fileToClose.close(); }