net.sf.asyncobjects.io.util
Class RandomTextInput

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

public class RandomTextInput
extends GeneratingInput<TextData,ATextInput>
implements ATextInput

A random text input. It uses internal array of to hold the data. It makes best effort to generate valid unicode codepoints.

Author:
const

Field Summary
 
Fields inherited from class net.sf.asyncobjects.io.util.GeneratingInput
UNLIMITED
 
Constructor Summary
RandomTextInput()
          A constructor for unlimited stream with limit 1024 and generator created with Random.Random()
RandomTextInput(Random random)
          A constructor for unlimited stream with limit 1024
RandomTextInput(Random random, int limit)
          A constructor for unlmited stream
RandomTextInput(Random random, int limit, long toGenerate)
          A constructor
 
Method Summary
protected  TextData generate(int toRead)
          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

RandomTextInput

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

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

RandomTextInput

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

Parameters:
random - a random number generator

RandomTextInput

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


RandomTextInput

public RandomTextInput(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 TextData generate(int toRead)
Description copied from class: GeneratingInput
Generate at most limit of the data

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


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.