public interface XMessageFormat<T>
PayloadFactory
specially within any processing elementsXMessage
,
PayloadFactory
Modifier and Type | Method and Description |
---|---|
XMessageFormat<T> |
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 |
default void |
markAsAttachedToaMessage()
Used to mark this
XMessageFormat has been set to a XMessage instance's payload so it would be
released with the said XMessage 's end of life. |
T |
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.
|
default void |
releaseResources()
Used to clear the underlying resources when such cleaning needed.
|
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
|
InputStream readAsStream()
String readAsString(int maxLengthKbs)
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.maxLengthKbs
- the maximum length of the payload in kilo bytes to be read. Set this value as -1 to read the
full payloadT readAsNative()
void writeTo(OutputStream outputStream) throws IOException
outputStream
- the output stream to which the payload has to be writtenIOException
- in case of an I/O errorXMessageFormat<T> copyOf()
UnsupportedOperationException
long size()
default void releaseResources()
default void markAsAttachedToaMessage()
XMessageFormat
has been set to a XMessage
instance's payload so it would be
released with the said XMessage
's end of life. Default implementation does nothing as all the
implementations of XMessageFormat
which require explicit resource cleaning should extend from
org.adroitlogic.x.base.format.ResourceAwareMessageFormat
classCopyright © 2016–2019 AdroitLogic. All rights reserved.