Package ghidra.app.util.bin
Class FaultTolerantInputStream
java.lang.Object
java.io.InputStream
ghidra.app.util.bin.FaultTolerantInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
An InputStream wrapper that suppresses any
IOException
s thrown by the wrapped stream
and starts returning 0 value bytes for all subsequent reads.-
Constructor Summary
ConstructorDescriptionFaultTolerantInputStream
(InputStream delegate, long length, BiConsumer<String, Throwable> errorConsumer) Creates instance. -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
FaultTolerantInputStream
public FaultTolerantInputStream(InputStream delegate, long length, BiConsumer<String, Throwable> errorConsumer) Creates instance.- Parameters:
delegate
-InputStream
to wraplength
- expected length of the streamerrorConsumer
- consumer that will accept errors, if null Msg.error() will be used
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-