iaik.security.random
Class RandomInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--iaik.security.random.RandomInputStream
- public class RandomInputStream
- extends java.io.InputStream
An InputStream that reads data from a Random number generator.
The Random number generator can be java.util.Random
or one of its subclasses java.security.SecureRandom,
iaik.security.random.SecRandom, etc.
- See Also:
SecRandom
|
Constructor Summary |
RandomInputStream(java.util.Random random)
Create a new RandomInputStream that reads from the specified
random number generator. |
|
Method Summary |
int |
available()
Return the number of bytes available for a non-blocking read from
this stream. |
int |
read()
Read one byte and return it. |
int |
read(byte[] b)
Read b.length bytes. |
int |
read(byte[] b,
int off,
int len)
Read len bytes into b. |
| Methods inherited from class java.io.InputStream |
close,
mark,
markSupported,
reset,
skip |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
RandomInputStream
public RandomInputStream(java.util.Random random)
- Create a new RandomInputStream that reads from the specified
random number generator.
read
public int read(byte[] b)
- Read b.length bytes.
- Overrides:
- read in class java.io.InputStream
read
public int read(byte[] b,
int off,
int len)
- Read len bytes into b.
- Overrides:
- read in class java.io.InputStream
read
public int read()
- Read one byte and return it.
- Overrides:
- read in class java.io.InputStream
available
public int available()
- Return the number of bytes available for a non-blocking read from
this stream. As the stream is of unlimited length, we return
Integer.MAX_VALUE (231 - 1).
This method never throws an IOException.
- Overrides:
- available in class java.io.InputStream