public class RandomInputStream
extends java.io.InputStream
Modifier and Type | Field and Description |
---|---|
private boolean |
binaryData
Flag controlling whether binary or character data is used
|
protected long |
lengthInBytes
The requested amount of data contained in this random stream
|
private static int |
MAX_CHAR_CODE
The maximum ASCII code contained in the data in this stream
|
private static int |
MIN_CHAR_CODE
The minimum ASCII code contained in the data in this stream
|
private static java.util.Random |
RANDOM
Shared Random number generator to generate data
|
protected long |
remainingBytes
The number of bytes of data remaining in this random stream
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
long |
getBytesRead() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
protected final long lengthInBytes
protected long remainingBytes
private static final java.util.Random RANDOM
private static final int MIN_CHAR_CODE
private static final int MAX_CHAR_CODE
private final boolean binaryData
public RandomInputStream(long lengthInBytes)
lengthInBytes
- The size in bytes of the total data returned by this
stream.public RandomInputStream(long lengthInBytes, boolean binaryData)
lengthInBytes
- The number of bytes in the stream.binaryData
- Whether binary or character data should be generated.public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public long getBytesRead()