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, count
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.BufferedOutputStream
write, write
Methods inherited from class java.io.FilterOutputStream
write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
BufferedOutputStreamWithCloseDetection
-
-
Method Details
-
flush
Don't flush empty buffer if already closed.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classBufferedOutputStream
- Throws:
IOException
-
close
Close only once.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-