Package org.pentaho.di.workarounds
Class BufferedOutputStreamWithCloseDetection
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.BufferedOutputStream
org.pentaho.di.workarounds.BufferedOutputStreamWithCloseDetection
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Workaround for stream close issue under Java 8.
The problem is: during Workbook writing to stream, Apache POI closes output stream itself. After that, ExcelWriteStep
closes this stream also because it was open in the ExcelWriterStep. But Java 8 contains bug
https://bugs.openjdk.java.net/browse/JDK-8042377 with second stream closing. As result, second close() throws
exception.
-
Field Summary
Fields inherited from class java.io.BufferedOutputStream
buf, countFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.BufferedOutputStream
write, writeMethods inherited from class java.io.FilterOutputStream
writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
BufferedOutputStreamWithCloseDetection
-
-
Method Details
-
flush
Don't flush empty buffer if already closed.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classBufferedOutputStream- Throws:
IOException
-
close
Close only once.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-