FileDocCategorySizeDatePackage
RandomInputStream.javaAPI DocExample829Sun Mar 28 19:05:44 BST 1999com.macfaq.io

RandomInputStream

public class RandomInputStream extends InputStream

Fields Summary
private transient Random
generator
Constructors Summary
Methods Summary
public intread()


     

    int result = generator.nextInt() % 256;
    if (result < 0) result = -result;
    return result;

  
public intread(byte[] data, int offset, int length)


    byte[] temp = new byte[length];
    generator.nextBytes(temp);
    System.arraycopy(temp, 0, data, offset, length);
    return length;

  
public intread(byte[] data)


    generator.nextBytes(data);
    return data.length;

  
public longskip(long bytesToSkip)

  
    // It's all random so skipping has no effect
    return bytesToSkip;