Class Bytes

java.lang.Object
com.palantir.conjure.java.lib.Bytes

public final class Bytes extends Object
An immutable byte[] wrapper.
  • Method Details

    • asReadOnlyByteBuffer

      public ByteBuffer asReadOnlyByteBuffer()
      Returns a new read-only ByteBuffer backed by this byte array.
    • asNewByteArray

      public byte[] asNewByteArray()
      Returns a new byte array containing the same content as this object's underlying byte[].
    • copyTo

      public void copyTo(byte[] destination, int offset, int length)
      Copies this byte array into the provided byte array beginning at offset and up to the provided length.
    • getInputStream

      public InputStream getInputStream()
      Returns a new InputStream that reads this byte array.
    • size

      public int size()
      Returns the size of this byte array.
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static Bytes from(byte[] array)
      Constructs a new Bytes from the provided array.
    • from

      public static Bytes from(byte[] array, int offset, int length)
      Constructs a new Bytes read from provided offset for the provided length.
    • from

      public static Bytes from(ByteBuffer buffer)
      Constructs a new Bytes read from the provided ByteBuffer.