pmp.io
Class RandomInputSource

java.lang.Object
  extended by pmp.io.RandomInputSource
All Implemented Interfaces:
java.io.Closeable, InputSource

public class RandomInputSource
extends java.lang.Object
implements InputSource

This class allows to give random data as input to macroprocessor.

Title: PMP: Macroprocessor

Description: Java macroprocessor

Copyright: Copyright (c) 2005

Version:
1.0
Author:
Luděk Hlaváček

Constructor Summary
RandomInputSource(java.util.Random source, int length)
           
 
Method Summary
 void close()
          Closes source.
 java.lang.String read(int maxLength)
          Reads up to length bytes from input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomInputSource

public RandomInputSource(java.util.Random source,
                         int length)
Method Detail

read

public java.lang.String read(int maxLength)
Description copied from interface: InputSource
Reads up to length bytes from input. If end of source was reached (end of file, socket closed or something like that) returns empty string.

Specified by:
read in interface InputSource
Parameters:
maxLength - maximal length of result; must not be zero!
Returns:
returned string.

close

public void close()
Description copied from interface: InputSource
Closes source. Macroprocessor will not call read after calling this method.

Specified by:
close in interface java.io.Closeable
Specified by:
close in interface InputSource