Package software.amazon.awssdk.testutils
Class RandomInputStream
java.lang.Object
java.io.InputStream
software.amazon.awssdk.testutils.RandomInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
UnreliableRandomInputStream
Test utility InputStream implementation that generates random ASCII data when
read, up to the size specified when constructed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longThe requested amount of data contained in this random stream.protected longThe number of bytes of data remaining in this random stream. -
Constructor Summary
ConstructorsConstructorDescriptionRandomInputStream(long lengthInBytes) Constructs a new InputStream, which will return the specified amount of bytes of random ASCII characters.RandomInputStream(long lengthInBytes, boolean binaryData) Creates a new random input stream of specified length, and specifies whether the stream should be full on binary or character data. -
Method Summary
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
-
Field Details
-
remainingBytes
protected long remainingBytesThe number of bytes of data remaining in this random stream. -
lengthInBytes
protected final long lengthInBytesThe requested amount of data contained in this random stream.
-
-
Constructor Details
-
RandomInputStream
public RandomInputStream(long lengthInBytes) Constructs a new InputStream, which will return the specified amount of bytes of random ASCII characters.- Parameters:
lengthInBytes- The size in bytes of the total data returned by this stream.
-
RandomInputStream
public RandomInputStream(long lengthInBytes, boolean binaryData) Creates a new random input stream of specified length, and specifies whether the stream should be full on binary or character data.- Parameters:
lengthInBytes- The number of bytes in the stream.binaryData- Whether binary or character data should be generated.
-
-
Method Details
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
getBytesRead
public long getBytesRead()
-