public class PayloadUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Payload |
toPayload(ByteArrayOutputStream bout)
Constructs a Payload around the given ByteArrayOutputStream.
|
static ExtendedPayload |
toPayload(ByteArrayOutputStream bout,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given ByteArrayOutputStream.
|
static Payload |
toPayload(InputStream input)
Constructs a Payload around the given InputStream.
|
static ExtendedPayload |
toPayload(InputStream input,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given InputStream and PayloadMetadata.
|
static Payload |
toPayload(JAXBContext jaxbContext,
Object obj)
Constructs a Payload around the given JAXB object.
|
static ExtendedPayload |
toPayload(JAXBContext jaxbContext,
Object obj,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given JAXB object.
|
static Payload |
toPayload(Node node)
Constructs a Payload around the given xml Node.
|
static ExtendedPayload |
toPayload(Node node,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given xml Node.
|
static Payload |
toPayload(Source source)
Constructs a Payload around the given xml Source.
|
static ExtendedPayload |
toPayload(Source source,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given xml Source.
|
static Payload |
toPayload(String input)
Constructs a Payload around the given String, to be encoded using the Atom default Charset.
|
static Payload |
toPayload(String input,
Charset charset)
Constructs a Payload around the given String, to be encoded using the given Charset.
|
static ExtendedPayload |
toPayload(String input,
Charset charset,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given String, to be encoded using the given Charset.
|
static ExtendedPayload |
toPayload(String input,
PayloadMetadata metadata)
Constructs a ExtendedPayload around the given String, to be encoded using the Atom default Charset.
|
public static Payload toPayload(InputStream input)
input
- input stream to be returned by the new Payloadpublic static ExtendedPayload toPayload(InputStream input, PayloadMetadata metadata)
input
- input stream to be returned by the new ExtendedPayloadmetadata
- PayloadMetadata to be used by the ExtendedPayloadpublic static Payload toPayload(JAXBContext jaxbContext, Object obj)
jaxbContext
- context which should be used to marshal the given objectobj
- JAXB object to be written by the new payloadpublic static ExtendedPayload toPayload(JAXBContext jaxbContext, Object obj, PayloadMetadata metadata)
jaxbContext
- context which should be used to marshal the given objectobj
- JAXB object to be written by the new ExtendedPayloadmetadata
- PayloadMetadata to be used by the ExtendedPayloadpublic static Payload toPayload(Node node)
node
- xml to be written by the new payloadpublic static ExtendedPayload toPayload(Node node, PayloadMetadata metadata)
node
- xml to be written by the new ExtendedPayloadmetadata
- PayloadMetadata to be used by the ExtendedPayloadpublic static Payload toPayload(Source source)
source
- xml to be written by the new payloadpublic static ExtendedPayload toPayload(Source source, PayloadMetadata metadata)
source
- xml to be written by the new ExtendedPayloadmetadata
- PayloadMetadata to be used by the ExtendedPayloadpublic static Payload toPayload(String input)
Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.
input
- input String to be encoded in the new Payloadpublic static ExtendedPayload toPayload(String input, PayloadMetadata metadata)
Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.
input
- input String to be encoded in the new ExtendedPayloadmetadata
- PayloadMetadata to be used by the ExtendedPayloadpublic static Payload toPayload(String input, Charset charset)
Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.
input
- input String to be encoded in the new Payloadcharset
- the charset to use when encoding the String, may be null
, in which case the Atom default
is usedpublic static ExtendedPayload toPayload(String input, Charset charset, PayloadMetadata metadata)
Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.
input
- input String to be encoded in the new ExtendedPayloadcharset
- the charset to use when encoding the String, may be null
, in which case the Atom default
is usedmetadata
- PayloadMetadata to be used by the ExtendedPayloadpublic static Payload toPayload(ByteArrayOutputStream bout)
Warning, the use of ByteArrayOutputStream is generally discouraged as it can cause memory issues. Please avoid if at all possible.
bout
- output stream containing the data to be writtenpublic static ExtendedPayload toPayload(ByteArrayOutputStream bout, PayloadMetadata metadata)
Warning, the use of ByteArrayOutputStream is generally discouraged as it can cause memory issues. Please avoid if at all possible.
bout
- output stream containing the data to be writtenmetadata
- PayloadMetadata to be used by the ExtendedPayload