net.sf.asyncobjects.io.util
Class RandomByteInput

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<I>
      extended by net.sf.asyncobjects.io.util.GeneratingInput<BinaryData,AByteInput>
          extended by net.sf.asyncobjects.io.util.RandomByteInput
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AByteInput, AInput<BinaryData>

public class RandomByteInput
extends GeneratingInput<BinaryData,AByteInput>
implements AByteInput

A random byte input. It uses internal array of to hold the data.

Author:
const

Field Summary
 
Fields inherited from class net.sf.asyncobjects.io.util.GeneratingInput
UNLIMITED
 
Constructor Summary
RandomByteInput()
          A constructor for unlimited stream with limit 1024 and generator created with Random.Random()
RandomByteInput(Random random)
          A constructor for unlimited stream with limit 1024
RandomByteInput(Random random, int limit)
          A constructor for unlmited stream
RandomByteInput(Random random, int limit, long toGenerate)
          A constructor
 
Method Summary
protected  BinaryData generate(int limit)
          Generate at most limit of the data
 
Methods inherited from class net.sf.asyncobjects.io.util.GeneratingInput
close, generated, isPushbackSupported, pushback, read
 
Methods inherited from class net.sf.asyncobjects.AsyncUnicastServer
dereference, export, isImmediate, myVat, promise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.asyncobjects.io.AInput
isPushbackSupported, pushback, read
 
Methods inherited from interface net.sf.asyncobjects.ACloseable
close
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Constructor Detail

RandomByteInput

public RandomByteInput(Random random,
                       int limit)
A constructor for unlmited stream

Parameters:
random - a random number generator
limit - a limit on data generated at one time

RandomByteInput

public RandomByteInput(Random random)
A constructor for unlimited stream with limit 1024

Parameters:
random - a random number generator

RandomByteInput

public RandomByteInput()
A constructor for unlimited stream with limit 1024 and generator created with Random.Random()


RandomByteInput

public RandomByteInput(Random random,
                       int limit,
                       long toGenerate)
A constructor

Parameters:
random - a random number generator
limit - a limit on data generated at one time
toGenerate - amount to generate
Method Detail

generate

protected BinaryData generate(int limit)
Description copied from class: GeneratingInput
Generate at most limit of the data

Specified by:
generate in class GeneratingInput<BinaryData,AByteInput>
Parameters:
limit - a limit on generated data
Returns:
a generated data
See Also:
GeneratingInput.generate(int)


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.