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

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

Best Java code snippets using org.apache.cassandra.utils.ByteBufferUtil.minimalBufferFor (Showing top 10 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: jsevellec/cassandra-unit

private static ByteBuffer maybeMinimize(ByteBuffer buffer)
{
  // ByteBuffer.minimalBufferFor doesn't handle null, but we can get it in this case since it's possible
  // for some clustering values to be null
  return buffer == null ? null : ByteBufferUtil.minimalBufferFor(buffer);
}
origin: org.apache.cassandra/cassandra-all

private static ByteBuffer maybeMinimize(ByteBuffer buffer)
{
  // ByteBuffer.minimalBufferFor doesn't handle null, but we can get it in this case since it's possible
  // for some clustering values to be null
  return buffer == null ? null : ByteBufferUtil.minimalBufferFor(buffer);
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

private static ByteBuffer maybeMinimize(ByteBuffer buffer)
{
  // ByteBuffer.minimalBufferFor doesn't handle null, but we can get it in this case since it's possible
  // for some clustering values to be null
  return buffer == null ? null : ByteBufferUtil.minimalBufferFor(buffer);
}
origin: com.strapdata.cassandra/cassandra-all

private static ByteBuffer maybeMinimize(ByteBuffer buffer)
{
  // ByteBuffer.minimalBufferFor doesn't handle null, but we can get it in this case since it's possible
  // for some clustering values to be null
  return buffer == null ? null : ByteBufferUtil.minimalBufferFor(buffer);
}
origin: com.facebook.presto.cassandra/cassandra-server

private static List<ByteBuffer> minimalBuffersFor(List<ByteBuffer> candidates)
{
  List<ByteBuffer> minimalBuffers = new ArrayList<ByteBuffer>(candidates.size());
  for (ByteBuffer byteBuffer : candidates)
    minimalBuffers.add(minimalBufferFor(byteBuffer));
  return minimalBuffers;
}
origin: jsevellec/cassandra-unit

public static ColumnIdentifier getInterned(AbstractType<?> type, ByteBuffer bytes, String text)
{
  bytes = ByteBufferUtil.minimalBufferFor(bytes);
  InternedKey key = new InternedKey(type, bytes);
  ColumnIdentifier id = internedInstances.get(key);
  if (id != null)
    return id;
  ColumnIdentifier created = new ColumnIdentifier(bytes, text, true);
  ColumnIdentifier previous = internedInstances.putIfAbsent(key, created);
  return previous == null ? created : previous;
}
origin: org.apache.cassandra/cassandra-all

public static ColumnIdentifier getInterned(AbstractType<?> type, ByteBuffer bytes, String text)
{
  bytes = ByteBufferUtil.minimalBufferFor(bytes);
  InternedKey key = new InternedKey(type, bytes);
  ColumnIdentifier id = internedInstances.get(key);
  if (id != null)
    return id;
  ColumnIdentifier created = new ColumnIdentifier(bytes, text, true);
  ColumnIdentifier previous = internedInstances.putIfAbsent(key, created);
  return previous == null ? created : previous;
}
origin: com.strapdata.cassandra/cassandra-all

public static ColumnIdentifier getInterned(AbstractType<?> type, ByteBuffer bytes, String text)
{
  bytes = ByteBufferUtil.minimalBufferFor(bytes);
  InternedKey key = new InternedKey(type, bytes);
  ColumnIdentifier id = internedInstances.get(key);
  if (id != null)
    return id;
  ColumnIdentifier created = new ColumnIdentifier(bytes, text, true);
  ColumnIdentifier previous = internedInstances.putIfAbsent(key, created);
  return previous == null ? created : previous;
}
origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Merge 2 lists of min cell name components.
 *
 * @param minColumnNames lhs
 * @param candidates rhs
 * @param comparator comparator to use
 * @return a list with smallest column names according to (sub)comparator
 */
public static List<ByteBuffer> mergeMin(List<ByteBuffer> minColumnNames, List<ByteBuffer> candidates, CellNameType comparator)
{
  if (minColumnNames.isEmpty())
    return minimalBuffersFor(candidates);
  if (candidates.isEmpty())
    return minColumnNames;
  List<ByteBuffer> biggest = minColumnNames.size() > candidates.size() ? minColumnNames : candidates;
  List<ByteBuffer> smallest = minColumnNames.size() > candidates.size() ? candidates : minColumnNames;
  // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller
  List<ByteBuffer> retList = smallest.size() == biggest.size()
               ? new ArrayList<>(smallest)
               : maybeGrow(smallest, biggest.size());
  for (int i = 0; i < biggest.size(); i++)
    retList.set(i, minimalBufferFor(min(retList.get(i), biggest.get(i), comparator.subtype(i))));
  return retList;
}
origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Merge 2 lists of max cell name components.
 *
 * @param maxColumnNames lhs
 * @param candidates rhs
 * @param comparator comparator to use
 * @return a list with biggest column names according to (sub)comparator
 */
public static List<ByteBuffer> mergeMax(List<ByteBuffer> maxColumnNames, List<ByteBuffer> candidates, CellNameType comparator)
{
  if (maxColumnNames.isEmpty())
    return minimalBuffersFor(candidates);
  if (candidates.isEmpty())
    return maxColumnNames;
  List<ByteBuffer> biggest = maxColumnNames.size() > candidates.size() ? maxColumnNames : candidates;
  List<ByteBuffer> smallest = maxColumnNames.size() > candidates.size() ? candidates : maxColumnNames;
  // We want to always copy the smallest list, and maybeGrow does it only if it's actually smaller
  List<ByteBuffer> retList = smallest.size() == biggest.size()
               ? new ArrayList<>(smallest)
               : maybeGrow(smallest, biggest.size());
  for (int i = 0; i < biggest.size(); i++)
    retList.set(i, minimalBufferFor(max(retList.get(i), biggest.get(i), comparator.subtype(i))));
  return retList;
}
org.apache.cassandra.utilsByteBufferUtilminimalBufferFor

Javadoc

trims size of bytebuffer to exactly number of bytes in it, to do not hold too much memory

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,
  • readBytesWithShortLength

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
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