Class RandomInputStream

java.lang.Object
java.io.InputStream
com.amazonaws.test.util.RandomInputStream
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
UnreliableRandomInputStream

public class RandomInputStream extends InputStream
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 Details

    • lengthInBytes

      protected final long lengthInBytes
      The requested amount of data contained in this random stream
    • remainingBytes

      protected long remainingBytes
      The 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