Static Public Member Functions | |
static ByteString | unsafeWrap (byte[] buffer) |
static ByteString | unsafeWrap (byte[] buffer) |
static ByteString | unsafeWrap (byte[] buffer, int offset, int length) |
static ByteString | unsafeWrap (byte[] buffer, int offset, int length) |
static ByteString | unsafeWrap (ByteBuffer buffer) |
static ByteString | unsafeWrap (ByteBuffer buffer) |
static void | unsafeWriteTo (ByteString bytes, ByteOutput output) throws IOException |
static void | unsafeWriteTo (ByteString bytes, ByteOutput output) throws IOException |
Private Member Functions | |
UnsafeByteOperations () | |
UnsafeByteOperations () | |
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 {} can lead to unexpected and undesirable consequences in your application, and will likely be difficult to debug. Proceed with caution! This can have a number of significant side affects that have spooky-action-at-a-distance-like behavior. In particular, if the bytes value changes out from under a Protocol Buffer:
Each of these issues will occur in parts of the code base that are entirely distinct from the parts of the code base modifying the buffer. In fact, both parts of the code base may be correct
Definition at line 65 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlineprivate |
Definition at line 66 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlineprivate |
Definition at line 66 of file protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by the provided buffer.
buffer | the buffer to be wrapped |
Definition at line 74 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by the provided buffer.
buffer | the buffer to be wrapped |
Definition at line 74 of file protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by a subregion of the provided buffer.
buffer | the buffer to be wrapped |
offset | the offset of the wrapped region |
length | the number of bytes of the wrapped region |
Definition at line 87 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by a subregion of the provided buffer.
buffer | the buffer to be wrapped |
offset | the offset of the wrapped region |
length | the number of bytes of the wrapped region |
Definition at line 87 of file protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by the provided buffer.
buffer | the Java NIO buffer to be wrapped |
Definition at line 97 of file protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by the provided buffer.
buffer | the Java NIO buffer to be wrapped |
Definition at line 97 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
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 {}s). This method exposes the internal backing buffer(s) of the ByteString to the {} 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.
bytes | the ByteString to be written |
output | the output to receive the bytes |
IOException | if an I/O error occurs |
Definition at line 117 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.
|
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 {}s). This method exposes the internal backing buffer(s) of the ByteString to the {} 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.
bytes | the ByteString to be written |
output | the output to receive the bytes |
IOException | if an I/O error occurs |
Definition at line 117 of file protobuf/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java.