public class ByteArrayFormat extends Object implements XMessageFormat<byte[]>
| Constructor and Description |
|---|
ByteArrayFormat(byte[] content) |
| Modifier and Type | Method and Description |
|---|---|
XMessageFormat<byte[]> |
copyOf()
Clones the message format possibly cloning the payload within this format, if an implementation doesn't
support cloning it is expected that particular implementation to throw an
UnsupportedOperationException |
byte[] |
readAsNative()
Reads the native value of the payload
|
InputStream |
readAsStream()
Reads the payload as an input stream
|
String |
readAsString(int maxLengthKbs)
Reads the payload as a string.
|
long |
size()
Gives the size of the underneath payload type, which is specific to the implementation of the message format.
|
void |
writeTo(OutputStream os)
Writes the payload into the given output stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmarkAsAttachedToaMessage, releaseResourcespublic InputStream readAsStream()
XMessageFormatreadAsStream in interface XMessageFormat<byte[]>public String readAsString(int maxLengthKbs)
XMessageFormatmaxLengthKbs, the output
will represent a truncated payload. Otherwise the the output will represent the full payload.
Depending on the type of the payload, the size of the resulting String will not be exactly the given size, but
rather an approximate value.readAsString in interface XMessageFormat<byte[]>maxLengthKbs - the maximum length of the payload in kilo bytes to be read. Set this value as -1 to read the
full payloadpublic byte[] readAsNative()
XMessageFormatreadAsNative in interface XMessageFormat<byte[]>public void writeTo(OutputStream os) throws IOException
XMessageFormatwriteTo in interface XMessageFormat<byte[]>os - the output stream to which the payload has to be writtenIOException - in case of an I/O errorpublic XMessageFormat<byte[]> copyOf()
XMessageFormatUnsupportedOperationExceptioncopyOf in interface XMessageFormat<byte[]>public long size()
XMessageFormatsize in interface XMessageFormat<byte[]>Copyright © 2016–2019 AdroitLogic. All rights reserved.