Class Data
java.lang.Object
org.apache.qpid.protonj2.types.messaging.Data
- All Implemented Interfaces:
Section<byte[]>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.qpid.protonj2.types.messaging.Section
Section.SectionType
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
copyTo
(ProtonBuffer target) Copies the binary payload of this Data section info the given target buffer.boolean
Returns theProtonBuffer
that contains the bytes carried in theData
section.int
getType()
byte[]
getValue()
Returns the backing array for this DataSection
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.int
hashCode()
toString()
-
Field Details
-
DESCRIPTOR_CODE
-
DESCRIPTOR_SYMBOL
-
-
Constructor Details
-
Data
-
Data
-
Data
public Data(byte[] value) -
Data
public Data(byte[] value, int offset, int length)
-
-
Method Details
-
copy
-
getBinary
-
getDataLength
public int getDataLength()- Returns:
- the number of actual bytes carried in this Data section.
-
getBuffer
Returns theProtonBuffer
that contains the bytes carried in theData
section. If the section carries no bytes then this method returns null. This method allows theData
section to be considered a carrier ofProtonBuffer
types instead of theBinary
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 thegetBinary()
method will create an instance that wraps the internalProtonBuffer
.- Returns:
- the
ProtonBuffer
that back this Data section.
-
copyTo
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 DataSection
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. -
toString
-
getType
- Specified by:
getType
in interfaceSection<byte[]>
- Returns:
- the
Section.SectionType
that describes this instance.
-
hashCode
public int hashCode() -
equals
-