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
FieldsModifier and TypeFieldDescriptionprotected Throwableprotected BiConsumer<? super Throwable,? super Throwable> Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionInputStreamWithCloseLogging(InputStream proxy, BiConsumer<? super Throwable, ? super Throwable> stackTraceConsumer) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static InputStreamwrap(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, unwrapMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
creationStackTrace
-
stackTraceConsumer
-
-
Constructor Details
-
InputStreamWithCloseLogging
public InputStreamWithCloseLogging(InputStream proxy, BiConsumer<? super Throwable, ? super Throwable> stackTraceConsumer)
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein 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)
-