Class AbstractInputStreamContent

    • Field Detail

      • type

        private java.lang.String type
        Content type or null for none.
      • closeInputStream

        private boolean closeInputStream
        Whether the input stream should be closed at the end of writeTo(java.io.OutputStream). Default is true.
    • Constructor Detail

      • AbstractInputStreamContent

        public AbstractInputStreamContent​(java.lang.String type)
        Parameters:
        type - Content type or null for none
        Since:
        1.5
    • Method Detail

      • getInputStream

        public abstract java.io.InputStream getInputStream()
                                                    throws java.io.IOException
        Return an input stream for the specific implementation type of AbstractInputStreamContent. If the specific implementation will return true for HttpContent.retrySupported() this should be a factory function which will create a new InputStream from the source data whenever invoked.
        Throws:
        java.io.IOException
        Since:
        1.7
      • writeTo

        public void writeTo​(java.io.OutputStream out)
                     throws java.io.IOException
        Description copied from interface: StreamingContent
        Writes the byte content to the given output stream.

        Implementations must not close the output stream, and instead should flush the output stream. Some callers may assume that the the output stream has not been closed, and will fail to work if it has been closed.

        Specified by:
        writeTo in interface HttpContent
        Specified by:
        writeTo in interface StreamingContent
        Parameters:
        out - output stream
        Throws:
        java.io.IOException
      • getType

        public java.lang.String getType()
        Description copied from interface: HttpContent
        Returns the content type or null for none.
        Specified by:
        getType in interface HttpContent
      • getCloseInputStream

        public final boolean getCloseInputStream()
        Returns whether the input stream should be closed at the end of writeTo(java.io.OutputStream). Default is true.
        Since:
        1.7
      • setType

        public AbstractInputStreamContent setType​(java.lang.String type)
        Sets the content type or null for none. Subclasses should override by calling super.
        Since:
        1.5