BigtableZeroCopyByteStringUtil (Cloud Bigtable HBase Client for Java 0.9.3-SNAPSHOT API)

com.google.protobuf

Class BigtableZeroCopyByteStringUtil



  • public final class BigtableZeroCopyByteStringUtil
    extends Object
    Helper class to extract byte arrays from ByteString without copy.

    Without this protobufs would force us to copy every single byte array out of the objects de-serialized from the wire (which already do one copy, on top of the copies the JVM does to go from kernel buffer to C buffer and from C buffer to JVM buffer).

    Version:
    $Id: $Id
    Author:
    sduskis
    • Constructor Detail

      • BigtableZeroCopyByteStringUtil

        public BigtableZeroCopyByteStringUtil()
    • Method Detail

      • wrap

        public static ByteString wrap(byte[] array)
        Wraps a byte array in a ByteString without copying it.
        Parameters:
        array - an array of byte.
        Returns:
        a ByteString object.
      • wrap

        public static ByteString wrap(byte[] array,
                                      int offset,
                                      int length)
        Wraps a subset of a byte array in a ByteString without copying it.
        Parameters:
        array - an array of byte.
        offset - a int.
        length - a int.
        Returns:
        a ByteString object.
      • zeroCopyGetBytes

        public static byte[] zeroCopyGetBytes(ByteString buf)
        Extracts the byte array from the given ByteString without copy.
        Parameters:
        buf - A buffer from which to extract the array.
        Returns:
        an array of byte.


Send feedback about...

Cloud Bigtable Documentation