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

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

Best Java code snippets using org.apache.cassandra.utils.ByteBufferUtil.compare (Showing top 6 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: tjake/Solandra

if (ByteBufferUtil.compare(col.name(), CassandraUtils.documentMetaFieldBytes.array()) == 0)
origin: hector-client/hector

private void testWriteLByteArray(int bufferSize) throws IOException {
 ByteBufferOutputStream sink = new ByteBufferOutputStream();
 byte[] written = new byte[bufferSize];
 new Random().nextBytes(written);
 sink.write(written);
 assertEquals(0, ByteBufferUtil.compare(sink.getByteBuffer(), written));
}

origin: hector-client/hector

@Test
public void testWriteLargeByteBuffer() throws IOException {
 ByteBufferOutputStream sink = new ByteBufferOutputStream();
 byte[] written = new byte[32 * 1000];
 new Random().nextBytes(written);
 sink.write(ByteBuffer.wrap(written));
 assertEquals(0, ByteBufferUtil.compare(sink.getByteBuffer(), written));
}

origin: hector-client/hector

@Test
public void testWriteByteArraySeveralSteps() throws IOException {
 ByteBufferOutputStream sink = new ByteBufferOutputStream();
 byte[] written = new byte[32 * ByteBufferOutputStream.INITIAL_BUFFER_SIZE];
 new Random().nextBytes(written);
 for(int i = 0; i < 32; i++) { 
  sink.write(written, i * ByteBufferOutputStream.INITIAL_BUFFER_SIZE, ByteBufferOutputStream.INITIAL_BUFFER_SIZE);      
 }
 assertEquals(0, ByteBufferUtil.compare(sink.getByteBuffer(), written));
}
origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Get specific ColumnDef in column family meta data by column name
 * @param columnFamily - CfDef record
 * @param columnName   - column name represented as byte[]
 * @return ColumnDef   - found column definition
 */
private ColumnDef getColumnDefByName(CfDef columnFamily, ByteBuffer columnName)
{
  for (ColumnDef columnDef : columnFamily.getColumn_metadata())
  {
    byte[] currName = columnDef.getName();
    if (ByteBufferUtil.compare(currName, columnName) == 0)
    {
      return columnDef;
    }
  }
  return null;
}
origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Converts column value into byte[] according to validation class
 * @param columnName - column name to which value belongs
 * @param columnFamilyName - column family name
 * @param columnValue - actual column value
 * @return value in byte array representation
 */
private ByteBuffer columnValueAsBytes(ByteBuffer columnName, String columnFamilyName, String columnValue)
{
  CfDef columnFamilyDef = getCfDef(columnFamilyName);
  AbstractType<?> defaultValidator = getFormatType(columnFamilyDef.default_validation_class);
  for (ColumnDef columnDefinition : columnFamilyDef.getColumn_metadata())
  {
    byte[] currentColumnName = columnDefinition.getName();
    if (ByteBufferUtil.compare(currentColumnName, columnName) == 0)
    {
      try
      {
        String validationClass = columnDefinition.getValidation_class();
        return getBytesAccordingToType(columnValue, getFormatType(validationClass));
      }
      catch (Exception e)
      {
        throw new RuntimeException(e);
      }
    }
  }
  return defaultValidator.fromString(columnValue);
}
org.apache.cassandra.utilsByteBufferUtilcompare

Javadoc

Compare two ByteBuffer at specified offsets for length. Compares the non equal bytes as unsigned.

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

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • requestLocationUpdates (LocationManager)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Notification (javax.management)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
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