Class InputStreamContent

  • All Implemented Interfaces:
    Content

    public class InputStreamContent
    extends AbstractContent
    Content within an InputStream.
    • Constructor Detail

      • InputStreamContent

        public InputStreamContent​(java.io.InputStream content)
        Create a new InputStream content.
        Parameters:
        content - the content.
      • InputStreamContent

        public InputStreamContent​(Content content)
                           throws java.io.IOException
        Create an InputStreamContent from another Content.
        Parameters:
        content - the content to duplicate.
        Throws:
        java.io.IOException - if IO error occurs
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Description copied from interface: Content
        The content bytes as a stream.
        Returns:
        InputStream to content.
        Throws:
        java.io.IOException - if an error occurs while creating the stream.
      • getSha256

        public java.lang.String getSha256()
                                   throws java.lang.Exception
        InputStream can only be read once.

        If sha256 is null, read and convert to in memory stream.

        Specified by:
        getSha256 in interface Content
        Overrides:
        getSha256 in class AbstractContent
        Returns:
        base64 encoded sha256 of content bytes.
        Throws:
        java.lang.Exception - if error occurs
      • close

        public void close()
        Free any resources associated with this content.