public class StringFormat extends Object implements XMessageFormat<String>
Constructor and Description |
---|
StringFormat(String content) |
Modifier and Type | Method and Description |
---|---|
XMessageFormat<String> |
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 |
String |
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 outputStream)
Writes the payload into the given output stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
markAsAttachedToaMessage, releaseResources
public StringFormat(String content)
public InputStream readAsStream()
XMessageFormat
readAsStream
in interface XMessageFormat<String>
public String readAsString(int maxLengthKbs)
XMessageFormat
maxLengthKbs
, 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<String>
maxLengthKbs
- the maximum length of the payload in kilo bytes to be read. Set this value as -1 to read the
full payloadpublic String readAsNative()
XMessageFormat
readAsNative
in interface XMessageFormat<String>
public void writeTo(OutputStream outputStream) throws IOException
XMessageFormat
writeTo
in interface XMessageFormat<String>
outputStream
- the output stream to which the payload has to be writtenIOException
- in case of an I/O errorpublic XMessageFormat<String> copyOf()
XMessageFormat
UnsupportedOperationException
copyOf
in interface XMessageFormat<String>
public long size()
XMessageFormat
size
in interface XMessageFormat<String>
Copyright © 2016–2019 AdroitLogic. All rights reserved.