org.eclipse.jgit.util.io

## Class SafeBufferedOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - java.io.BufferedOutputStream
      - - org.eclipse.jgit.util.io.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.

### Field Summary

### Fields inherited from class java.io.BufferedOutputStream

`buf, count`

### Fields inherited from class java.io.FilterOutputStream

`out`

### Constructor Summary

Constructors
Constructor and Description
`SafeBufferedOutputStream(OutputStream out)`
`SafeBufferedOutputStream(OutputStream out, int size)`

### Method Summary

Methods
`void` `close()`

### Methods inherited from class java.io.BufferedOutputStream

`flush, write, write`

### Methods inherited from class java.io.FilterOutputStream

`write`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SafeBufferedOutputStream

    public SafeBufferedOutputStream(OutputStream out)

Parameters:
  `out` - underlying output stream
See Also:
  `BufferedOutputStream.BufferedOutputStream(OutputStream)`

#### SafeBufferedOutputStream

    public SafeBufferedOutputStream(OutputStream out,
                            int size)

Parameters:
  `out` - underlying output stream
  `size` - buffer size
See Also:
  `BufferedOutputStream.BufferedOutputStream(OutputStream, int)`

### Method Detail

#### close

    public void close()
               throws IOException

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Overrides:
  `close` in class `FilterOutputStream`
Throws:
  `IOException`