Package com.amazonaws.test.util
Class RandomInputStream
java.lang.Object
java.io.InputStream
com.amazonaws.test.util.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.
- Author:
- Jason Fulghum <fulghum@amazon.com>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final long
The requested amount of data contained in this random streamprotected long
The 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, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
lengthInBytes
protected final long lengthInBytesThe requested amount of data contained in this random stream -
remainingBytes
protected long remainingBytesThe number of bytes of data remaining 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:
read
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
getBytesRead
public long getBytesRead()
-