/** * Used only for internal testing purposes. Makes a stream unreliable in certain ways for * fault testing. * * @param content Input stream to make unreliable. * @return UnreliableFilterInputStream */ private InputStream wrapWithUnreliableStream(InputStream content) { return new UnreliableFilterInputStream(content, unreliableTestConfig.isFakeIOException()) .withBytesReadBeforeException( unreliableTestConfig.getBytesReadBeforeException()) .withMaxNumErrors(unreliableTestConfig.getMaxNumErrors()) .withResetIntervalBeforeException( unreliableTestConfig.getResetIntervalBeforeException()); }
@Override public int read(byte[] b, int off, int len) throws IOException { triggerError(); int read = super.read(b, off, len); position += read; triggerError(); return read; }
/** * Used only for internal testing purposes. Makes a stream unreliable in certain ways for * fault testing. * * @param content Input stream to make unreliable. * @return UnreliableFilterInputStream */ private InputStream wrapWithUnreliableStream(InputStream content) { return new UnreliableFilterInputStream(content, unreliableTestConfig.isFakeIOException()) .withBytesReadBeforeException( unreliableTestConfig.getBytesReadBeforeException()) .withMaxNumErrors(unreliableTestConfig.getMaxNumErrors()) .withResetIntervalBeforeException( unreliableTestConfig.getResetIntervalBeforeException()); }
@Override public int read() throws IOException { int read = super.read(); if (read != -1) position++; triggerError(); return read; }
/** * Used only for internal testing purposes. Makes a stream unreliable in certain ways for * fault testing. * * @param content Input stream to make unreliable. * @return UnreliableFilterInputStream */ private InputStream wrapWithUnreliableStream(InputStream content) { return new UnreliableFilterInputStream(content, unreliableTestConfig.isFakeIOException()) .withBytesReadBeforeException( unreliableTestConfig.getBytesReadBeforeException()) .withMaxNumErrors(unreliableTestConfig.getMaxNumErrors()) .withResetIntervalBeforeException( unreliableTestConfig.getResetIntervalBeforeException()); }
@Override public int read(byte[] b, int off, int len) throws IOException { triggerError(); int read = super.read(b, off, len); position += read; triggerError(); return read; }
@Override public int read() throws IOException { int read = super.read(); if (read != -1) position++; triggerError(); return read; }
@Override public int read(byte[] b, int off, int len) throws IOException { triggerError(); int read = super.read(b, off, len); position += read; triggerError(); return read; }
@Override public int read() throws IOException { int read = super.read(); if (read != -1) position++; triggerError(); return read; }