Class UnreliableFilterInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- software.amazon.awssdk.core.internal.util.UnreliableFilterInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class UnreliableFilterInputStream extends FilterInputStream
An internal class used solely for the purpose of testing via failure injection.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description UnreliableFilterInputStream(InputStream in, boolean isFakeIoException)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBytesReadBeforeException()
int
getCurrNumErrors()
int
getMarked()
int
getMaxNumErrors()
int
getPosition()
int
getResetCount()
int
getResetIntervalBeforeException()
boolean
isFakeIoException()
void
mark(int readlimit)
int
read()
int
read(byte[] b, int off, int len)
void
reset()
String
toString()
UnreliableFilterInputStream
withBytesReadBeforeException(int bytesReadBeforeException)
UnreliableFilterInputStream
withMaxNumErrors(int maxNumErrors)
UnreliableFilterInputStream
withResetIntervalBeforeException(int resetIntervalBeforeException)
-
Methods inherited from class java.io.FilterInputStream
available, close, markSupported, read, skip
-
-
-
-
Constructor Detail
-
UnreliableFilterInputStream
public UnreliableFilterInputStream(InputStream in, boolean isFakeIoException)
-
-
Method Detail
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classFilterInputStream
-
reset
public void reset() throws IOException
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
getCurrNumErrors
public int getCurrNumErrors()
-
getMaxNumErrors
public int getMaxNumErrors()
-
withMaxNumErrors
public UnreliableFilterInputStream withMaxNumErrors(int maxNumErrors)
-
withBytesReadBeforeException
public UnreliableFilterInputStream withBytesReadBeforeException(int bytesReadBeforeException)
-
getBytesReadBeforeException
public int getBytesReadBeforeException()
-
withResetIntervalBeforeException
public UnreliableFilterInputStream withResetIntervalBeforeException(int resetIntervalBeforeException)
- Parameters:
resetIntervalBeforeException
- used to control whether an exception would be thrown based on the reset recurrence; not applicable if set to zero. For example, if resetIntervalBeforeException == n, the exception can only be thrown before the n_th reset (or after the n_th minus 1 reset), 2n_th reset (or after the 2n_th minus 1) reset), etc.
-
getResetIntervalBeforeException
public int getResetIntervalBeforeException()
-
getMarked
public int getMarked()
-
getPosition
public int getPosition()
-
isFakeIoException
public boolean isFakeIoException()
-
getResetCount
public int getResetCount()
-
-