Example usage for org.apache.cassandra.io.util FileDataInput bytesPastMark

List of usage examples for org.apache.cassandra.io.util FileDataInput bytesPastMark

Introduction

In this page you can find the example usage for org.apache.cassandra.io.util FileDataInput bytesPastMark.

Prototype

long bytesPastMark(DataPosition mark);

Source Link

Usage

From source file:com.datastax.brisk.BriskServer.java

License:Apache License

private Integer seekToSubColumn(CFMetaData metadata, FileDataInput file, ByteBuffer sblockId,
        List<IndexHelper.IndexInfo> indexList) throws IOException {
    file.readInt(); // column count

    /* get the various column ranges we have to read */
    AbstractType comparator = metadata.comparator;

    int index = IndexHelper.indexFor(sblockId, indexList, comparator, false);
    if (index == indexList.size())
        return null;

    IndexHelper.IndexInfo indexInfo = indexList.get(index);
    if (comparator.compare(sblockId, indexInfo.firstName) < 0)
        return null;

    FileMark mark = file.mark();/*from ww w .ja va 2 s  .c om*/

    FileUtils.skipBytesFully(file, indexInfo.offset);

    while (file.bytesPastMark(mark) < indexInfo.offset + indexInfo.width) {
        Integer dataLength = isSubBlockFound(metadata, file, sblockId);

        if (dataLength == null)
            return null;

        if (dataLength < 0)
            continue;

        return dataLength;
    }

    return null;
}