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

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

Best Java code snippets using org.apache.cassandra.utils.ByteBufferUtil.arrayCopy (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

  public void write(ByteBuffer buffer) throws IOException
  {
    int len = buffer.remaining();
    ByteBufferUtil.arrayCopy(buffer, buffer.position(), this.buffer, this.buffer.position(), len);
    this.buffer.position(this.buffer.position() + len);
  }
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static int put(ByteBuffer src, ByteBuffer trg)
{
  int length = Math.min(src.remaining(), trg.remaining());
  arrayCopy(src, src.position(), trg, trg.position(), length);
  trg.position(trg.position() + length);
  src.position(src.position() + length);
  return length;
}
origin: org.apache.cassandra/cassandra-all

public static int put(ByteBuffer src, ByteBuffer trg)
{
  int length = Math.min(src.remaining(), trg.remaining());
  arrayCopy(src, src.position(), trg, trg.position(), length);
  trg.position(trg.position() + length);
  src.position(src.position() + length);
  return length;
}
origin: jsevellec/cassandra-unit

public static int put(ByteBuffer src, ByteBuffer trg)
{
  int length = Math.min(src.remaining(), trg.remaining());
  arrayCopy(src, src.position(), trg, trg.position(), length);
  trg.position(trg.position() + length);
  src.position(src.position() + length);
  return length;
}
origin: org.apache.cassandra/cassandra-clientutil

public static int put(ByteBuffer src, ByteBuffer trg)
{
  int length = Math.min(src.remaining(), trg.remaining());
  arrayCopy(src, src.position(), trg, trg.position(), length);
  trg.position(trg.position() + length);
  src.position(src.position() + length);
  return length;
}
origin: com.strapdata.cassandra/cassandra-all

public static int put(ByteBuffer src, ByteBuffer trg)
{
  int length = Math.min(src.remaining(), trg.remaining());
  arrayCopy(src, src.position(), trg, trg.position(), length);
  trg.position(trg.position() + length);
  src.position(src.position() + length);
  return length;
}
origin: com.facebook.presto.cassandra/cassandra-server

@Override
public final void readFully(byte[] bytes) throws IOException
{
  ByteBufferUtil.arrayCopy(buffer, buffer.position() + position, bytes, 0, bytes.length);
  position += bytes.length;
}
origin: com.facebook.presto.cassandra/cassandra-server

public void write(ByteBuffer buffer)
{
  int len = buffer.remaining();
  expand(len);
  ByteBufferUtil.arrayCopy(buffer, buffer.position(), buf, this.count, len);
  this.count += len;
}
origin: jsevellec/cassandra-unit

public static ByteBuffer build(boolean isStatic, ByteBuffer... buffers)
{
  int totalLength = isStatic ? 2 : 0;
  for (ByteBuffer bb : buffers)
    totalLength += 2 + bb.remaining() + 1;
  ByteBuffer out = ByteBuffer.allocate(totalLength);
  if (isStatic)
    out.putShort((short)STATIC_MARKER);
  for (ByteBuffer bb : buffers)
  {
    ByteBufferUtil.writeShortLength(out, bb.remaining());
    int toCopy = bb.remaining();
    ByteBufferUtil.arrayCopy(bb, bb.position(), out, out.position(), toCopy);
    out.position(out.position() + toCopy);
    out.put((byte) 0);
  }
  out.flip();
  return out;
}
origin: com.strapdata.cassandra/cassandra-all

public static ByteBuffer build(boolean isStatic, ByteBuffer... buffers)
{
  int totalLength = isStatic ? 2 : 0;
  for (ByteBuffer bb : buffers)
    totalLength += 2 + bb.remaining() + 1;
  ByteBuffer out = ByteBuffer.allocate(totalLength);
  if (isStatic)
    out.putShort((short)STATIC_MARKER);
  for (ByteBuffer bb : buffers)
  {
    ByteBufferUtil.writeShortLength(out, bb.remaining());
    int toCopy = bb.remaining();
    ByteBufferUtil.arrayCopy(bb, bb.position(), out, out.position(), toCopy);
    out.position(out.position() + toCopy);
    out.put((byte) 0);
  }
  out.flip();
  return out;
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static ByteBuffer build(boolean isStatic, ByteBuffer... buffers)
{
  int totalLength = isStatic ? 2 : 0;
  for (ByteBuffer bb : buffers)
    totalLength += 2 + bb.remaining() + 1;
  ByteBuffer out = ByteBuffer.allocate(totalLength);
  if (isStatic)
    out.putShort((short)STATIC_MARKER);
  for (ByteBuffer bb : buffers)
  {
    ByteBufferUtil.writeShortLength(out, bb.remaining());
    int toCopy = bb.remaining();
    ByteBufferUtil.arrayCopy(bb, bb.position(), out, out.position(), toCopy);
    out.position(out.position() + toCopy);
    out.put((byte) 0);
  }
  out.flip();
  return out;
}
origin: org.apache.cassandra/cassandra-all

public static ByteBuffer build(boolean isStatic, ByteBuffer... buffers)
{
  int totalLength = isStatic ? 2 : 0;
  for (ByteBuffer bb : buffers)
    totalLength += 2 + bb.remaining() + 1;
  ByteBuffer out = ByteBuffer.allocate(totalLength);
  if (isStatic)
    out.putShort((short)STATIC_MARKER);
  for (ByteBuffer bb : buffers)
  {
    ByteBufferUtil.writeShortLength(out, bb.remaining());
    int toCopy = bb.remaining();
    ByteBufferUtil.arrayCopy(bb, bb.position(), out, out.position(), toCopy);
    out.position(out.position() + toCopy);
    out.put((byte) 0);
  }
  out.flip();
  return out;
}
origin: jsevellec/cassandra-unit

ByteBufferUtil.arrayCopy(context,
             context.position() + HEADER_SIZE_LENGTH,
             marked,
origin: com.facebook.presto.cassandra/cassandra-server

ByteBufferUtil.arrayCopy(context,
             context.position() + HEADER_SIZE_LENGTH,
             marked,
origin: org.apache.cassandra/cassandra-all

ByteBufferUtil.arrayCopy(context,
             context.position() + HEADER_SIZE_LENGTH,
             marked,
origin: com.facebook.presto.cassandra/cassandra-server

public synchronized void write(ByteBuffer buffer) throws IOException
{
  int len = buffer.remaining();
  if (len < 16)
  {
    int offset = buffer.position();
    for (int i = 0 ; i < len ; i++)
      write(buffer.get(i + offset));
    return;
  }
  byte[] buf = this.buf;
  if (buf == null)
    this.buf = buf = new byte[256];
  int offset = 0;
  while (len > 0)
  {
    int sublen = Math.min(buf.length, len);
    ByteBufferUtil.arrayCopy(buffer, buffer.position() + offset, buf, 0, sublen);
    write(buf, 0, sublen);
    offset += sublen;
    len -= sublen;
  }
}
origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

@Override
public int write(ByteBuffer src) throws IOException
{
  int toWrite = src.remaining();
  if (src.hasArray())
  {
    outputStream.write(src.array(), src.arrayOffset() + src.position(), src.remaining());
    src.position(src.limit());
    return toWrite;
  }
  if (toWrite < 16)
  {
    int offset = src.position();
    for (int i = 0 ; i < toWrite ; i++)
      outputStream.write(src.get(i + offset));
    src.position(src.limit());
    return toWrite;
  }
  byte[] buf = retrieveTemporaryBuffer(toWrite);
  int totalWritten = 0;
  while (totalWritten < toWrite)
  {
    int toWriteThisTime = Math.min(buf.length, toWrite - totalWritten);
    org.apache.cassandra.utils.ByteBufferUtil.arrayCopy(src, src.position() + totalWritten, buf, 0, toWriteThisTime);
    outputStream.write(buf, 0, toWriteThisTime);
    totalWritten += toWriteThisTime;
  }
  src.position(src.limit());
  return totalWritten;
}
origin: jsevellec/cassandra-unit

@Override
public int write(ByteBuffer src) throws IOException
{
  int toWrite = src.remaining();
  if (src.hasArray())
  {
    DataOutputStreamPlus.this.write(src.array(), src.arrayOffset() + src.position(), src.remaining());
    src.position(src.limit());
    return toWrite;
  }
  if (toWrite < 16)
  {
    int offset = src.position();
    for (int i = 0 ; i < toWrite ; i++)
      DataOutputStreamPlus.this.write(src.get(i + offset));
    src.position(src.limit());
    return toWrite;
  }
  byte[] buf = retrieveTemporaryBuffer(toWrite);
  int totalWritten = 0;
  while (totalWritten < toWrite)
  {
    int toWriteThisTime = Math.min(buf.length, toWrite - totalWritten);
    ByteBufferUtil.arrayCopy(src, src.position() + totalWritten, buf, 0, toWriteThisTime);
    DataOutputStreamPlus.this.write(buf, 0, toWriteThisTime);
    totalWritten += toWriteThisTime;
  }
  src.position(src.limit());
  return totalWritten;
}
origin: com.facebook.presto.cassandra/cassandra-server

public void update(ByteBuffer b, int off, int len)
{
  if (b.hasArray())
  {
    update(b.array(), b.arrayOffset() + off, len);
  }
  else if (len < 16)
  {
    doUpdate(b, off, len);
  }
  else
  {
    byte[] buf = BUFFER.get();
    while (len > 0)
    {
      int l = Math.min(len, buf.length);
      ByteBufferUtil.arrayCopy(b, off, buf, 0, l);
      update(buf, 0, l);
      len -= l;
      off += l;
    }
  }
}
origin: com.facebook.presto.cassandra/cassandra-server

private int writeAtMost(ByteBuffer data, int offset, int length)
{
  if (current >= bufferOffset + buffer.length)
    reBuffer();
  assert current < bufferOffset + buffer.length
  : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);
  int toCopy = Math.min(length, buffer.length - bufferCursor());
  // copy bytes from external buffer
  ByteBufferUtil.arrayCopy(data, offset, buffer, bufferCursor(), toCopy);
  assert current <= bufferOffset + buffer.length
  : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset);
  validBufferBytes = Math.max(validBufferBytes, bufferCursor() + toCopy);
  current += toCopy;
  return toCopy;
}
org.apache.cassandra.utilsByteBufferUtilarrayCopy

Javadoc

Transfer bytes from one ByteBuffer to another. This function acts as System.arrayCopy() but for ByteBuffers.

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
  • compareUnsigned
  • readBytes,
  • compareUnsigned,
  • read,
  • readShortLength,
  • compareSubArrays,
  • ensureCapacity,
  • getShortLength,
  • minimalBufferFor,
  • readBytesWithShortLength

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
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