java.lang.Object
org.apache.qpid.protonj2.types.messaging.Data
All Implemented Interfaces:
Section<byte[]>

public final class Data extends Object implements Section<byte[]>
  • Field Details

    • DESCRIPTOR_CODE

      public static final UnsignedLong DESCRIPTOR_CODE
    • DESCRIPTOR_SYMBOL

      public static final Symbol DESCRIPTOR_SYMBOL
  • Constructor Details

    • Data

      public Data(Binary binary)
    • Data

      public Data(ProtonBuffer buffer)
    • Data

      public Data(byte[] value)
    • Data

      public Data(byte[] value, int offset, int length)
  • Method Details

    • copy

      public Data copy()
    • getBinary

      public Binary getBinary()
    • getDataLength

      public int getDataLength()
      Returns:
      the number of actual bytes carried in this Data section.
    • getBuffer

      public ProtonBuffer getBuffer()
      Returns the ProtonBuffer that contains the bytes carried in the Data section. If the section carries no bytes then this method returns null. This method allows the Data section to be considered a carrier of ProtonBuffer types instead of the Binary value it will encode as part of its body and avoids creation of a Binary object when one is not needed. If a Binary instance is required then calling the getBinary() method will create an instance that wraps the internal ProtonBuffer.
      Returns:
      the ProtonBuffer that back this Data section.
    • copyTo

      public Data copyTo(ProtonBuffer target)
      Copies the binary payload of this Data section info the given target buffer.
      Parameters:
      target - The buffer where the binary payload is written to.
      Returns:
      this Data section instance.
    • getValue

      public byte[] getValue()
      Returns the backing array for this Data Section copying the contents into a new array instance if the backing array in the contained Binary is a subsequence of a larger referenced array instance.
      Specified by:
      getValue in interface Section<byte[]>
      Returns:
      the byte array view of this Data Section Binary payload.
    • toString

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

      public Section.SectionType getType()
      Specified by:
      getType in interface Section<byte[]>
      Returns:
      the Section.SectionType that describes this instance.
    • hashCode

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

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