Class RandomInputStream

java.lang.Object
java.io.InputStream
software.amazon.awssdk.testutils.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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final long
    The requested amount of data contained in this random stream.
    protected long
    The number of bytes of data remaining in this random stream.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RandomInputStream(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

    Modifier and Type
    Method
    Description
    long
     
    int
     
    int
    read(byte[] b, int off, int len)
     

    Methods inherited from class java.io.InputStream

    available, close, mark, markSupported, read, reset, skip

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • remainingBytes

      protected long remainingBytes
      The number of bytes of data remaining in this random stream.
    • lengthInBytes

      protected final long lengthInBytes
      The 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