@Override
	public int read(byte[] b, int off, int len) throws IOException {
		if (error == null) {
			// haven't hit an error yet, try to read normally
			try {
				int bytesRead = delegate.read(b, off, len);
				currentPosition += bytesRead;
				return bytesRead;
			}
			catch (IOException e) {
				faultPosition = currentPosition;
				error = e;
			}
		}

		// there was an error, return 0's from now on
		long remaining = totalLength - currentPosition;
		if (remaining <= 0) {
			return 0;
		}
		len = (int) Math.min(len, remaining);
		Arrays.fill(b, off, off + len, (byte) 0);
		currentPosition += len;
		faultByteCount += len;
		return len;
	}
Creates instance.

@param delegate {@link InputStream} to wrap
@param length expected length of the stream
@param errorConsumer consumer that will accept errors, if null Msg.error() will be used
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/FaultTolerantInputStream.java