Package net.sansa_stack.hadoop.util
Class InputStreamWithCloseLogging
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.commons.io.input.ProxyInputStream
-
- net.sansa_stack.hadoop.util.InputStreamWithCloseLogging
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class InputStreamWithCloseLogging extends org.apache.commons.io.input.ProxyInputStream
Util class to debug a stream already closed exception
-
-
Field Summary
Fields Modifier and Type Field Description protected Throwable
creationStackTrace
protected BiConsumer<? super Throwable,? super Throwable>
stackTraceConsumer
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description InputStreamWithCloseLogging(InputStream proxy, BiConsumer<? super Throwable,? super Throwable> stackTraceConsumer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static InputStream
wrap(InputStream proxy, Function<? super Throwable,String> toString, Consumer<? super String> logger)
Convenience method for e.g.-
Methods inherited from class org.apache.commons.io.input.ProxyInputStream
afterRead, available, beforeRead, handleIOException, mark, markSupported, read, read, read, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Field Detail
-
creationStackTrace
protected Throwable creationStackTrace
-
stackTraceConsumer
protected BiConsumer<? super Throwable,? super Throwable> stackTraceConsumer
-
-
Constructor Detail
-
InputStreamWithCloseLogging
public InputStreamWithCloseLogging(InputStream proxy, BiConsumer<? super Throwable,? super Throwable> stackTraceConsumer)
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classorg.apache.commons.io.input.ProxyInputStream
- Throws:
IOException
-
wrap
public static InputStream wrap(InputStream proxy, Function<? super Throwable,String> toString, Consumer<? super String> logger)
Convenience method for e.g. .wrap(inputStream, ExceptionUtils::getFullStackTrace, logger::info)
-
-