Java Randomness Test Suite

JRandTest at SourceForge

com.fasteasytrade.JRandTest.IO
Interface RandomStream

All Known Subinterfaces:
AlgoRandomStream
All Known Implementing Classes:
FileAlgoRandomStream, FileRandomStream, HttpGetUrlRandomStream

public interface RandomStream

RandomStream interface represen stream of data to be checked by the different tests. The interface will be implemented by real classes to read data from files, external devices, web urls or algorithms.

Author:
Zur Aougav

Method Summary
 boolean closeInputStream()
          close the input stream.
 String getFilename()
          get the file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.
 boolean isOpen()
          check if RandomStream is open
 boolean openInputStream()
          open the input stream.
 byte readByte()
          read one byte from a file.
 int readInt()
          Processing is similar to readByte.
 long readLong()
          Processing is similar to readByte.
 void setFilename(String s)
          set file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.
 

Method Detail

isOpen

public boolean isOpen()
check if RandomStream is open

Returns:
true if open (still data in stream), else flase

setFilename

public void setFilename(String s)
set file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.

Returns:
true if open (still data in stream), else flase

getFilename

public String getFilename()
get the file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.

Returns:
string null if missing, else the filename from setFilename.

openInputStream

public boolean openInputStream()
                        throws Exception
open the input stream.

Returns:
boolean true for success, else false.
Throws:
Exception - - Usually IOException.

closeInputStream

public boolean closeInputStream()
close the input stream.

Returns:
boolean true for success, else false.

readByte

public byte readByte()
              throws Exception
read one byte from a file.

first time ( if !isOpen() ) open file/stream, and return byte

at end of file close stream and returns -1

Returns:
byte read form stream, -1 if passed end of file
Throws:
Exception

readInt

public int readInt()
            throws Exception
Processing is similar to readByte.

Returns:
int (32 bits, 4 bytes) read form stream, -1 if passed end of file
Throws:
Exception

readLong

public long readLong()
              throws Exception
Processing is similar to readByte.

Returns:
long (64 bits, 8 bytes) read form stream, -1 if passed end of file
Throws:
Exception

Java Randomness Test Suite

JRandTest at SourceForge

JRandTest at SourceForge
Copyright © 2005 Zur Aougav. All Rights Reserved.