Class LongStringHelper.ByteArrayLongString
java.lang.Object
com.rabbitmq.client.impl.LongStringHelper.ByteArrayLongString
- All Implemented Interfaces:
LongString
- Enclosing class:
LongStringHelper
Private API - Implementation of
LongString. When
interpreting bytes as a string, uses UTF-8 encoding.-
Field Summary
FieldsFields inherited from interface LongString
MAX_LENGTH -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
bytes
private final byte[] bytes
-
-
Constructor Details
-
ByteArrayLongString
public ByteArrayLongString(byte[] bytes)
-
-
Method Details
-
equals
-
hashCode
-
getBytes
public byte[] getBytes()Get the content as a byte array. This need not be a copy. Updates to the returned array may change the value of the string. Repeated calls to this function may return the same array. This function will fail if this string's length is greater thanInteger.MAX_VALUE, throwing anIllegalStateException.- Specified by:
getBytesin interfaceLongString- Returns:
- the array of bytes containing the content of the
LongString
-
getStream
Get the content stream. Repeated calls to this function return the same stream, which may not support rewind.- Specified by:
getStreamin interfaceLongString- Returns:
- An input stream that reads the content of the string
- Throws:
IOException- if an error is encountered
-
length
public long length()- Specified by:
lengthin interfaceLongString- Returns:
- the length of the string in bytes between 0 and MAX_LENGTH (inclusive)
-
toString
Description copied from interface:LongStringGet the content as a String. Uses UTF-8 as encoding.- Specified by:
toStringin interfaceLongString- Overrides:
toStringin classObject- Returns:
- he content of the
LongStringas a string
-