Class ByteArray

    • Method Detail

      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • length

        public final int length()
        Returns the number of bytes in this ByteArray.
      • toByteArray

        public final byte[] toByteArray()
        Returns a copy of this ByteArray as an array of bytes.
      • toStringUtf8

        public final String toStringUtf8()
        Returns a copy of this ByteArray as an UTF-8 string.
      • toBase64

        public final String toBase64()
        Converts this byte array to its base64 representation.
      • asReadOnlyByteBuffer

        public final ByteBuffer asReadOnlyByteBuffer()
        Returns the content of this ByteArray as a read-only ByteBuffer.
      • copyTo

        public final void copyTo​(byte[] target)
        Copies the content of this ByteArray into an array of bytes.
        Throws:
        IndexOutOfBoundsException - if the target is not large enough to hold the data
      • copyFrom

        public static final ByteArray copyFrom​(byte[] bytes)
        Creates a ByteArray object given an array of bytes. The bytes are copied.
      • copyFrom

        public static final ByteArray copyFrom​(String string)
        Creates a ByteArray object given a string. The string is encoded in UTF-8. The bytes are copied.
      • fromBase64

        public static ByteArray fromBase64​(String data)
        Creates a ByteArray from a base64 representation.