webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Static Public Member Functions | List of all members
com.google.protobuf.UnsafeByteOperations Class Reference

Static Public Member Functions

static ByteString unsafeWrap (ByteBuffer buffer)
 
static void unsafeWriteTo (ByteString bytes, ByteOutput output) throws IOException
 

Detailed Description

Provides a number of unsafe byte operations to be used by advanced applications with high performance requirements. These methods are referred to as "unsafe" due to the fact that they potentially expose the backing buffer of a ByteString to the application.

DISCLAIMER: The methods in this class should only be called if it is guaranteed that the buffer backing the ByteString will never change! Mutation of a ByteString can lead to unexpected and undesirable consequences in your application, and will likely be difficult to debug. Proceed with caution!

Member Function Documentation

◆ unsafeWrap()

static ByteString com.google.protobuf.UnsafeByteOperations.unsafeWrap ( ByteBuffer  buffer)
inlinestatic

An unsafe operation that returns a ByteString that is backed by the provided buffer.

Parameters
bufferthe Java NIO buffer to be wrapped
Returns
a ByteString backed by the provided buffer

◆ unsafeWriteTo()

static void com.google.protobuf.UnsafeByteOperations.unsafeWriteTo ( ByteString  bytes,
ByteOutput  output 
) throws IOException
inlinestatic

Writes the given ByteString to the provided ByteOutput. Calling this method may result in multiple operations on the target ByteOutput (i.e. for roped ByteStrings).

This method exposes the internal backing buffer(s) of the ByteString to the ByteOutput in order to avoid additional copying overhead. It would be possible for a malicious ByteOutput to corrupt the ByteString. Use with caution!

NOTE: The ByteOutput MUST NOT modify the provided buffers. Doing so may result in corrupted data, which would be difficult to debug.

Parameters
bytesthe ByteString to be written
outputthe output to receive the bytes
Exceptions
IOExceptionif an I/O error occurs

The documentation for this class was generated from the following file: