/** * Same as {@link #openInputStream()} but handling destruction of any * associated resources automatically when closing the returned stream. * * @return an InputStream which will automatically destroy any associated * temporary file on {@link #close()} * @throws IOException * in case of an error. * @since 4.11 */ public InputStream openInputStreamWithAutoDestroy() throws IOException { return new BlockInputStream() { @Override public void close() throws IOException { super.close(); destroy(); } }; }
/** * Open an input stream to read from the buffered data. * <p> * This method may only be invoked after {@link #close()} has completed * normally, to ensure all data is completely transferred. * * @return a stream to read from the buffer. The caller must close the * stream when it is no longer useful. * @throws IOException * an error occurred opening the temporary file. */ public InputStream openInputStream() throws IOException { return new BlockInputStream(); }
/** * Open an input stream to read from the buffered data. * <p> * This method may only be invoked after {@link #close()} has completed * normally, to ensure all data is completely transferred. * * @return a stream to read from the buffer. The caller must close the * stream when it is no longer useful. * @throws java.io.IOException * an error occurred opening the temporary file. */ public InputStream openInputStream() throws IOException { return new BlockInputStream(); }
/** * Same as {@link #openInputStream()} but handling destruction of any * associated resources automatically when closing the returned stream. * * @return an InputStream which will automatically destroy any associated * temporary file on {@link #close()} * @throws IOException * in case of an error. * @since 4.11 */ public InputStream openInputStreamWithAutoDestroy() throws IOException { return new BlockInputStream() { @Override public void close() throws IOException { super.close(); destroy(); } }; }
/** * Open an input stream to read from the buffered data. * <p> * This method may only be invoked after {@link #close()} has completed * normally, to ensure all data is completely transferred. * * @return a stream to read from the buffer. The caller must close the * stream when it is no longer useful. * @throws java.io.IOException * an error occurred opening the temporary file. */ public InputStream openInputStream() throws IOException { return new BlockInputStream(); }