webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
Static Public Member Functions | |
static ByteString | unsafeWrap (ByteBuffer buffer) |
static void | unsafeWriteTo (ByteString bytes, ByteOutput output) throws IOException |
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!
|
inlinestatic |
An unsafe operation that returns a ByteString that is backed by the provided buffer.
buffer | the Java NIO buffer to be wrapped |
|
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.
bytes | the ByteString to be written |
output | the output to receive the bytes |
IOException | if an I/O error occurs |