Class DataSourceStreamingDataHandler

    • Constructor Detail

      • DataSourceStreamingDataHandler

        public DataSourceStreamingDataHandler​(@Nonnull
                                              jakarta.activation.DataSource aDataSource)
    • Method Detail

      • readOnce

        public InputStream readOnce()
                             throws IOException
        Description copied from class: AbstractStreamingDataHandler
        Works like DataHandler.getInputStream() except that this method can be invoked only once.
        This is used as a signal from the caller that there will be no further DataHandler.getInputStream() invocation nor AbstractStreamingDataHandler.readOnce() invocation on this object (which would result in IOException.)
        When DataHandler is backed by a streaming BLOB (such as an attachment in a web service read from the network), this allows the callee to avoid unnecessary buffering.
        Note that it is legal to call DataHandler.getInputStream() multiple times and then call AbstractStreamingDataHandler.readOnce() afterward. Streams created such a way can be read in any order - there's no requirement that streams created earlier must be read first.
        Specified by:
        readOnce in class AbstractStreamingDataHandler
        Returns:
        always non-null. Represents the content of this BLOB. The returned stream is generally not buffered, so for better performance read in a big batch or wrap this into BufferedInputStream.
        Throws:
        IOException - if any i/o error