Package com.boomi.connector.api
Interface Payload
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Subinterfaces:
ExtendedPayload
- All Known Implementing Classes:
BasePayload
public interface Payload extends Closeable
A Payload encapsulates result data in some form. Either the data is readily available as an InputStream or can be written into an OutputStream. A payload is consumed by first callingreadFrom()
and seeing if the result is non-null
. If so, that stream is read and closed. If the result isnull
, then thewriteTo(java.io.OutputStream)
method will be called with an OutputStream which can be filled with the payload data. Moved this interface fromcommonsdk
toconnector-sdk-api
to ensure strict and non-strict connectors can access this functionality independently.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description InputStream
readFrom()
Returns a valid InputStream for this payload, ornull
if not supported.void
writeTo(OutputStream out)
Writes the payload data to the given OutputStream.
-
-
-
Method Detail
-
readFrom
InputStream readFrom() throws IOException
Returns a valid InputStream for this payload, ornull
if not supported. If this method returns a valid InputStream,writeTo(java.io.OutputStream)
will never be called.- Throws:
IOException
-
writeTo
void writeTo(OutputStream out) throws IOException
Writes the payload data to the given OutputStream. IfreadFrom()
returnsnull
, this method must be implemented.- Parameters:
out
- non-null
output stream to which to write the payload data- Throws:
IOException
-
-