Class SafeBufferedOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public class SafeBufferedOutputStream
    extends BufferedOutputStream
    A BufferedOutputStream that throws an error if the final flush fails on close.

    Java's BufferedOutputStream swallows errors that occur when the output stream tries to write the final bytes to the output during close. This may result in corrupted files without notice.