com.rabbitmq.client.impl
Class LongStringHelper.ByteArrayLongString

java.lang.Object
  extended by com.rabbitmq.client.impl.LongStringHelper.ByteArrayLongString
All Implemented Interfaces:
LongString
Enclosing class:
LongStringHelper

public static class LongStringHelper.ByteArrayLongString
extends java.lang.Object
implements LongString

Private API - Implementation of LongString. When interpreting bytes as a string, uses UTF-8 encoding.


Field Summary
 
Fields inherited from interface com.rabbitmq.client.impl.LongString
MAX_LENGTH
 
Constructor Summary
LongStringHelper.ByteArrayLongString(byte[] bytes)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 byte[] getBytes()
          Get the content as a byte array.
 java.io.DataInputStream getStream()
          Get the content stream.
 int hashCode()
           
 long length()
          Get the length of the content of the long string in bytes
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongStringHelper.ByteArrayLongString

public LongStringHelper.ByteArrayLongString(byte[] bytes)
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getBytes

public byte[] getBytes()
Get the content as a byte array. Repeated calls to this function return the same array. This function will fail if getContentLength() > Integer.MAX_VALUE throwing an IllegalStateException.

Specified by:
getBytes in interface LongString
Returns:
the content as an array

getStream

public java.io.DataInputStream getStream()
                                  throws java.io.IOException
Get the content stream. Repeated calls to this function return the same stream, which may not support rewind.

Specified by:
getStream in interface LongString
Returns:
An input stream the reads the content
Throws:
java.io.IOException - if an error is encountered

length

public long length()
Get the length of the content of the long string in bytes

Specified by:
length in interface LongString
Returns:
the length in bytes >= 0 <= MAX_LENGTH

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object