Codota Logo
ByteBufferUtil.readWithLength
Code IndexAdd Codota to your IDE (free)

How to use
readWithLength
method
in
org.apache.cassandra.utils.ByteBufferUtil

Best Java code snippets using org.apache.cassandra.utils.ByteBufferUtil.readWithLength (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: com.facebook.presto.cassandra/cassandra-server

Cell deserializeColumnBody(DataInput in, CellName name, int mask, ColumnSerializer.Flag flag, int expireBefore) throws IOException
{
  if ((mask & COUNTER_MASK) != 0)
  {
    long timestampOfLastDelete = in.readLong();
    long ts = in.readLong();
    ByteBuffer value = ByteBufferUtil.readWithLength(in);
    return BufferCounterCell.create(name, value, ts, timestampOfLastDelete, flag);
  }
  else if ((mask & EXPIRATION_MASK) != 0)
  {
    int ttl = in.readInt();
    int expiration = in.readInt();
    long ts = in.readLong();
    ByteBuffer value = ByteBufferUtil.readWithLength(in);
    return BufferExpiringCell.create(name, value, ts, ttl, expiration, expireBefore, flag);
  }
  else
  {
    long ts = in.readLong();
    ByteBuffer value = ByteBufferUtil.readWithLength(in);
    return (mask & COUNTER_UPDATE_MASK) != 0
        ? new BufferCounterUpdateCell(name, value, ts)
        : ((mask & DELETION_MASK) == 0
         ? new BufferCell(name, value, ts)
         : new BufferDeletedCell(name, value, ts));
  }
}
origin: jsevellec/cassandra-unit

  /**
   * Deserializes the first and last key stored in the summary
   *
   * Only for use by offline tools like SSTableMetadataViewer, otherwise SSTable.first/last should be used.
   */
  public Pair<DecoratedKey, DecoratedKey> deserializeFirstLastKey(DataInputStream in, IPartitioner partitioner, boolean haveSamplingLevel) throws IOException
  {
    in.skipBytes(4); // minIndexInterval
    int offsetCount = in.readInt();
    long offheapSize = in.readLong();
    if (haveSamplingLevel)
      in.skipBytes(8); // samplingLevel, fullSamplingSummarySize
    in.skip(offsetCount * 4);
    in.skip(offheapSize - offsetCount * 4);
    DecoratedKey first = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    DecoratedKey last = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    return Pair.create(first, last);
  }
}
origin: org.apache.cassandra/cassandra-all

  /**
   * Deserializes the first and last key stored in the summary
   *
   * Only for use by offline tools like SSTableMetadataViewer, otherwise SSTable.first/last should be used.
   */
  public Pair<DecoratedKey, DecoratedKey> deserializeFirstLastKey(DataInputStream in, IPartitioner partitioner, boolean haveSamplingLevel) throws IOException
  {
    in.skipBytes(4); // minIndexInterval
    int offsetCount = in.readInt();
    long offheapSize = in.readLong();
    if (haveSamplingLevel)
      in.skipBytes(8); // samplingLevel, fullSamplingSummarySize
    in.skip(offsetCount * 4);
    in.skip(offheapSize - offsetCount * 4);
    DecoratedKey first = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    DecoratedKey last = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    return Pair.create(first, last);
  }
}
origin: com.strapdata.cassandra/cassandra-all

  /**
   * Deserializes the first and last key stored in the summary
   *
   * Only for use by offline tools like SSTableMetadataViewer, otherwise SSTable.first/last should be used.
   */
  public Pair<DecoratedKey, DecoratedKey> deserializeFirstLastKey(DataInputStream in, IPartitioner partitioner, boolean haveSamplingLevel) throws IOException
  {
    in.skipBytes(4); // minIndexInterval
    int offsetCount = in.readInt();
    long offheapSize = in.readLong();
    if (haveSamplingLevel)
      in.skipBytes(8); // samplingLevel, fullSamplingSummarySize
    in.skip(offsetCount * 4);
    in.skip(offheapSize - offsetCount * 4);
    DecoratedKey first = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    DecoratedKey last = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    return Pair.create(first, last);
  }
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

  /**
   * Deserializes the first and last key stored in the summary
   *
   * Only for use by offline tools like SSTableMetadataViewer, otherwise SSTable.first/last should be used.
   */
  public Pair<DecoratedKey, DecoratedKey> deserializeFirstLastKey(DataInputStream in, IPartitioner partitioner, boolean haveSamplingLevel) throws IOException
  {
    in.skipBytes(4); // minIndexInterval
    int offsetCount = in.readInt();
    long offheapSize = in.readLong();
    if (haveSamplingLevel)
      in.skipBytes(8); // samplingLevel, fullSamplingSummarySize
    in.skip(offsetCount * 4);
    in.skip(offheapSize - offsetCount * 4);
    DecoratedKey first = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    DecoratedKey last = partitioner.decorateKey(ByteBufferUtil.readWithLength(in));
    return Pair.create(first, last);
  }
}
origin: jsevellec/cassandra-unit

    iStream, getPartitioner(), descriptor.version.hasSamplingLevel(),
    metadata.params.minIndexInterval, metadata.params.maxIndexInterval);
first = decorateKey(ByteBufferUtil.readWithLength(iStream));
last = decorateKey(ByteBufferUtil.readWithLength(iStream));
origin: org.apache.cassandra/cassandra-all

    iStream, getPartitioner(), descriptor.version.hasSamplingLevel(),
    metadata.params.minIndexInterval, metadata.params.maxIndexInterval);
first = decorateKey(ByteBufferUtil.readWithLength(iStream));
last = decorateKey(ByteBufferUtil.readWithLength(iStream));
origin: com.strapdata.cassandra/cassandra-all

    iStream, getPartitioner(), descriptor.version.hasSamplingLevel(),
    metadata.params.minIndexInterval, metadata.params.maxIndexInterval);
first = decorateKey(ByteBufferUtil.readWithLength(iStream));
last = decorateKey(ByteBufferUtil.readWithLength(iStream));
origin: jsevellec/cassandra-unit

final ByteBuffer partitionKey = ByteBufferUtil.readWithLength(in);
final ByteBuffer cellName = ByteBufferUtil.readWithLength(in);
if (cfs == null || !cfs.metadata.isCounter() || !cfs.isCounterCacheEnabled())
  return null;
origin: com.strapdata.cassandra/cassandra-all

final ByteBuffer partitionKey = ByteBufferUtil.readWithLength(in);
final ByteBuffer cellName = ByteBufferUtil.readWithLength(in);
if (cfs == null || !cfs.metadata.isCounter() || !cfs.isCounterCacheEnabled())
  return null;
origin: com.facebook.presto.cassandra/cassandra-server

final ByteBuffer partitionKey = ByteBufferUtil.readWithLength(in);
ByteBuffer cellNameBuffer = ByteBufferUtil.readWithLength(in);
if (cfs == null || !cfs.metadata.isCounter() || !cfs.isCounterCacheEnabled())
  return null;
origin: jsevellec/cassandra-unit

ByteBuffer value = ByteBufferUtil.readWithLength(in);
if (flag == SerializationHelper.Flag.FROM_REMOTE || (flag == SerializationHelper.Flag.LOCAL && CounterContext.instance().shouldClearLocal(value)))
  value = CounterContext.instance().clearAllLocal(value);
int expiration = in.readInt();
long ts = in.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(in);
return new LegacyCell(LegacyCell.Kind.EXPIRING, decodeCellName(metadata, cellname, readAllAsDynamic), value, ts, expiration, ttl);
ByteBuffer value = ByteBufferUtil.readWithLength(in);
LegacyCellName name = decodeCellName(metadata, cellname, readAllAsDynamic);
return (mask & COUNTER_UPDATE_MASK) != 0
origin: org.apache.cassandra/cassandra-all

ByteBuffer value = ByteBufferUtil.readWithLength(in);
if (flag == SerializationHelper.Flag.FROM_REMOTE || (flag == SerializationHelper.Flag.LOCAL && CounterContext.instance().shouldClearLocal(value)))
  value = CounterContext.instance().clearAllLocal(value);
int expiration = in.readInt();
long ts = in.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(in);
return new LegacyCell(LegacyCell.Kind.EXPIRING, decodeCellName(metadata, cellname, readAllAsDynamic), value, ts, expiration, ttl);
ByteBuffer value = ByteBufferUtil.readWithLength(in);
LegacyCellName name = decodeCellName(metadata, cellname, readAllAsDynamic);
return (mask & COUNTER_UPDATE_MASK) != 0
origin: com.strapdata.cassandra/cassandra-all

ByteBuffer value = ByteBufferUtil.readWithLength(in);
if (flag == SerializationHelper.Flag.FROM_REMOTE || (flag == SerializationHelper.Flag.LOCAL && CounterContext.instance().shouldClearLocal(value)))
  value = CounterContext.instance().clearAllLocal(value);
int expiration = in.readInt();
long ts = in.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(in);
return new LegacyCell(LegacyCell.Kind.EXPIRING, decodeCellName(metadata, cellname, readAllAsDynamic), value, ts, expiration, ttl);
ByteBuffer value = ByteBufferUtil.readWithLength(in);
LegacyCellName name = decodeCellName(metadata, cellname, readAllAsDynamic);
return (mask & COUNTER_UPDATE_MASK) != 0
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

ByteBuffer value = ByteBufferUtil.readWithLength(in);
if (flag == SerializationHelper.Flag.FROM_REMOTE || (flag == SerializationHelper.Flag.LOCAL && CounterContext.instance().shouldClearLocal(value)))
  value = CounterContext.instance().clearAllLocal(value);
int expiration = in.readInt();
long ts = in.readLong();
ByteBuffer value = ByteBufferUtil.readWithLength(in);
return new LegacyCell(LegacyCell.Kind.EXPIRING, decodeCellName(metadata, cellname, readAllAsDynamic), value, ts, expiration, ttl);
ByteBuffer value = ByteBufferUtil.readWithLength(in);
LegacyCellName name = decodeCellName(metadata, cellname, readAllAsDynamic);
return (mask & COUNTER_UPDATE_MASK) != 0
origin: com.facebook.presto.cassandra/cassandra-server

  public Future<Pair<RowCacheKey, IRowCacheEntry>> deserialize(DataInputStream in, final ColumnFamilyStore cfs) throws IOException
  {
    //Keyspace and CF name are deserialized by AutoSaving cache and used to fetch the CFS provided as a
    //parameter so they aren't deserialized here, even though they are serialized by this serializer
    final ByteBuffer buffer = ByteBufferUtil.readWithLength(in);
    if (cfs == null  || !cfs.isRowCacheEnabled())
      return null;
    assert(!cfs.isIndex());
    return StageManager.getStage(Stage.READ).submit(new Callable<Pair<RowCacheKey, IRowCacheEntry>>()
    {
      public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception
      {
        DecoratedKey key = cfs.partitioner.decorateKey(buffer);
        QueryFilter cacheFilter = new QueryFilter(key, cfs.getColumnFamilyName(), cfs.readFilterForCache(), Integer.MIN_VALUE);
        ColumnFamily data = cfs.getTopLevelColumns(cacheFilter, Integer.MIN_VALUE);
        return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry) data);
      }
    });
  }
}
origin: org.apache.cassandra/cassandra-all

  public Future<Pair<RowCacheKey, IRowCacheEntry>> deserialize(DataInputPlus in, final ColumnFamilyStore cfs) throws IOException
  {
    //Keyspace and CF name are deserialized by AutoSaving cache and used to fetch the CFS provided as a
    //parameter so they aren't deserialized here, even though they are serialized by this serializer
    final ByteBuffer buffer = ByteBufferUtil.readWithLength(in);
    if (cfs == null  || !cfs.isRowCacheEnabled())
      return null;
    final int rowsToCache = cfs.metadata.params.caching.rowsPerPartitionToCache();
    assert(!cfs.isIndex());//Shouldn't have row cache entries for indexes
    return StageManager.getStage(Stage.READ).submit(new Callable<Pair<RowCacheKey, IRowCacheEntry>>()
    {
      public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception
      {
        DecoratedKey key = cfs.decorateKey(buffer);
        int nowInSec = FBUtilities.nowInSeconds();
        SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key);
        try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller))
        {
          CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec);
          return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache);
        }
      }
    });
  }
}
origin: jsevellec/cassandra-unit

  public Future<Pair<RowCacheKey, IRowCacheEntry>> deserialize(DataInputPlus in, final ColumnFamilyStore cfs) throws IOException
  {
    //Keyspace and CF name are deserialized by AutoSaving cache and used to fetch the CFS provided as a
    //parameter so they aren't deserialized here, even though they are serialized by this serializer
    final ByteBuffer buffer = ByteBufferUtil.readWithLength(in);
    if (cfs == null  || !cfs.isRowCacheEnabled())
      return null;
    final int rowsToCache = cfs.metadata.params.caching.rowsPerPartitionToCache();
    assert(!cfs.isIndex());//Shouldn't have row cache entries for indexes
    return StageManager.getStage(Stage.READ).submit(new Callable<Pair<RowCacheKey, IRowCacheEntry>>()
    {
      public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception
      {
        DecoratedKey key = cfs.decorateKey(buffer);
        int nowInSec = FBUtilities.nowInSeconds();
        SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key);
        try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller))
        {
          CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec);
          return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache);
        }
      }
    });
  }
}
origin: com.strapdata.cassandra/cassandra-all

  public Future<Pair<RowCacheKey, IRowCacheEntry>> deserialize(DataInputPlus in, final ColumnFamilyStore cfs) throws IOException
  {
    //Keyspace and CF name are deserialized by AutoSaving cache and used to fetch the CFS provided as a
    //parameter so they aren't deserialized here, even though they are serialized by this serializer
    final ByteBuffer buffer = ByteBufferUtil.readWithLength(in);
    if (cfs == null  || !cfs.isRowCacheEnabled())
      return null;
    final int rowsToCache = cfs.metadata.params.caching.rowsPerPartitionToCache();
    assert(!cfs.isIndex());//Shouldn't have row cache entries for indexes
    return StageManager.getStage(Stage.READ).submit(new Callable<Pair<RowCacheKey, IRowCacheEntry>>()
    {
      public Pair<RowCacheKey, IRowCacheEntry> call() throws Exception
      {
        DecoratedKey key = cfs.decorateKey(buffer);
        int nowInSec = FBUtilities.nowInSeconds();
        SinglePartitionReadCommand cmd = SinglePartitionReadCommand.fullPartitionRead(cfs.metadata, nowInSec, key);
        try (ReadExecutionController controller = cmd.executionController(); UnfilteredRowIterator iter = cmd.queryMemtableAndDisk(cfs, controller))
        {
          CachedPartition toCache = CachedBTreePartition.create(DataLimits.cqlLimits(rowsToCache).filter(iter, nowInSec, true), nowInSec);
          return Pair.create(new RowCacheKey(cfs.metadata.ksAndCFName, key), (IRowCacheEntry)toCache);
        }
      }
    });
  }
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

    iStream, getPartitioner(), descriptor.version.hasSamplingLevel(),
    metadata.params.minIndexInterval, metadata.params.maxIndexInterval);
first = decorateKey(ByteBufferUtil.readWithLength(iStream));
last = decorateKey(ByteBufferUtil.readWithLength(iStream));
org.apache.cassandra.utilsByteBufferUtilreadWithLength

Popular methods of ByteBufferUtil

  • bytes
  • string
    Decode a String representation.
  • bytesToHex
  • getArray
    You should almost never use this. Instead, use the write* methods to avoid copies.
  • clone
  • hexToBytes
  • toFloat
  • toInt
    Convert a byte buffer to an integer. Does not change the byte buffer position.
  • toLong
  • toDouble
  • readBytes
  • arrayCopy
  • readBytes,
  • arrayCopy,
  • compareUnsigned,
  • read,
  • readShortLength,
  • compareSubArrays,
  • ensureCapacity,
  • getShortLength,
  • minimalBufferFor,
  • readBytesWithShortLength

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • getContentResolver (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Join (org.hibernate.mapping)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now