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