Class BytesWrapper

    • Method Detail

      • asByteBuffer

        public final ByteBuffer asByteBuffer()
        Returns:
        The output as a read-only byte buffer.
      • asByteArrayUnsafe

        public final byte[] asByteArrayUnsafe()
        Returns:
        The output as a byte array. This does not create a copy of the underlying byte array. This introduces concurrency risks, allowing: (1) the caller to modify the byte array stored in this object implementation AND (2) the original creator of this object, if they created it using the unsafe method.

        Consider using asByteBuffer(), which is a safer method to avoid an additional array copy because it does not provide a way to modify the underlying buffer. As the method name implies, this is unsafe. If you're not sure, don't use this. The only guarantees given to the user of this method is that the SDK itself won't modify the underlying byte array.

        See Also:
        to prevent creating an additional array copy safely.
      • asInputStream

        public final InputStream asInputStream()
        Returns:
        The output as an input stream. This stream will not need to be closed.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object