public final class ByteArrayPayload extends Object implements Payload, Serializable
| Constructor and Description |
|---|
ByteArrayPayload(byte[] bytes,
MIMEType type) |
ByteArrayPayload(InputStream stream,
MIMEType type) |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getInputStream()
Returns the input stream of the payload.
|
MIMEType |
getMimeType()
Return the mime-type of the payload.
|
boolean |
isAvailable()
Returns
true if the payload is available, IE. |
long |
length()
Returns the length of the stream.
|
public ByteArrayPayload(InputStream stream, MIMEType type) throws IOException
IOExceptionpublic ByteArrayPayload(byte[] bytes,
MIMEType type)
public MIMEType getMimeType()
PayloadgetMimeType in interface Payloadpublic InputStream getInputStream()
PayloadgetInputStream in interface Payloadnull if the payload is not available.public long length()
PayloadHTTPResponse,
this is the value of the Content-Length header. If the payload is used in a request, it can be set,
or calculated based on the type.public boolean isAvailable()
Payloadtrue if the payload is available, IE. If the stream can be read from.isAvailable in interface Payloadtrue if the payload is available. false if not.Copyright © 2008–2017. All rights reserved.