Class PayloadUtil


  • public class PayloadUtil
    extends Object
    This class has been moved from com.boomi.connector.api to com.boomi.connector.util.
    • Method Detail

      • toPayload

        public static Payload toPayload​(InputStream input)
        Constructs a Payload around the given InputStream.
        Parameters:
        input - input stream to be returned by the new Payload
      • toPayload

        public static ExtendedPayload toPayload​(InputStream input,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given InputStream and PayloadMetadata.
        Parameters:
        input - input stream to be returned by the new ExtendedPayload
        metadata - PayloadMetadata to be used by the ExtendedPayload
      • toPayload

        public static Payload toPayload​(javax.xml.bind.JAXBContext jaxbContext,
                                        Object obj)
        Constructs a Payload around the given JAXB object.
        Parameters:
        jaxbContext - context which should be used to marshal the given object
        obj - JAXB object to be written by the new payload
      • toPayload

        public static ExtendedPayload toPayload​(javax.xml.bind.JAXBContext jaxbContext,
                                                Object obj,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given JAXB object.
        Parameters:
        jaxbContext - context which should be used to marshal the given object
        obj - JAXB object to be written by the new ExtendedPayload
        metadata - PayloadMetadata to be used by the ExtendedPayload
      • toPayload

        public static Payload toPayload​(Node node)
        Constructs a Payload around the given xml Node.
        Parameters:
        node - xml to be written by the new payload
      • toPayload

        public static ExtendedPayload toPayload​(Node node,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given xml Node.
        Parameters:
        node - xml to be written by the new ExtendedPayload
        metadata - PayloadMetadata to be used by the ExtendedPayload
      • toPayload

        public static Payload toPayload​(Source source)
        Constructs a Payload around the given xml Source.
        Parameters:
        source - xml to be written by the new payload
      • toPayload

        public static ExtendedPayload toPayload​(Source source,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given xml Source.
        Parameters:
        source - xml to be written by the new ExtendedPayload
        metadata - PayloadMetadata to be used by the ExtendedPayload
      • toPayload

        public static Payload toPayload​(String input)
        Constructs a Payload around the given String, to be encoded using the Atom default Charset.

        Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.

        Parameters:
        input - input String to be encoded in the new Payload
      • toPayload

        public static ExtendedPayload toPayload​(String input,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given String, to be encoded using the Atom default Charset.

        Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.

        Parameters:
        input - input String to be encoded in the new ExtendedPayload
        metadata - PayloadMetadata to be used by the ExtendedPayload
      • toPayload

        public static Payload toPayload​(String input,
                                        Charset charset)
        Constructs a Payload around the given String, to be encoded using the given Charset.

        Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.

        Parameters:
        input - input String to be encoded in the new Payload
        charset - the charset to use when encoding the String, may be null, in which case the Atom default is used
      • toPayload

        public static ExtendedPayload toPayload​(String input,
                                                Charset charset,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given String, to be encoded using the given Charset.

        Warning, the use of String output is generally discouraged as it can cause memory issues. Please avoid if at all possible.

        Parameters:
        input - input String to be encoded in the new ExtendedPayload
        charset - the charset to use when encoding the String, may be null, in which case the Atom default is used
        metadata - PayloadMetadata to be used by the ExtendedPayload
      • toPayload

        public static Payload toPayload​(ByteArrayOutputStream bout)
        Constructs a Payload around the given ByteArrayOutputStream.

        Warning, the use of ByteArrayOutputStream is generally discouraged as it can cause memory issues. Please avoid if at all possible.

        Parameters:
        bout - output stream containing the data to be written
      • toPayload

        public static ExtendedPayload toPayload​(ByteArrayOutputStream bout,
                                                PayloadMetadata metadata)
        Constructs a ExtendedPayload around the given ByteArrayOutputStream.

        Warning, the use of ByteArrayOutputStream is generally discouraged as it can cause memory issues. Please avoid if at all possible.

        Parameters:
        bout - output stream containing the data to be written
        metadata - PayloadMetadata to be used by the ExtendedPayload