Java Randomness Test Suite

JRandTest at SourceForge

com.fasteasytrade.JRandTest.IO
Class HttpGetUrlRandomStream

java.lang.Object
  extended bycom.fasteasytrade.JRandTest.IO.HttpGetUrlRandomStream
All Implemented Interfaces:
RandomStream

public class HttpGetUrlRandomStream
extends Object
implements RandomStream

This class represents an encrypted or random source HTTP Url source.

Data, bytes or int32, are read from url.

Author:
Zur Aougav

Field Summary
(package private)  byte[] buffer
           
(package private)  URLConnection con
           
(package private)  int count
           
(package private)  int countLastRead
           
(package private)  String filename
           
(package private)  DataInputStream infile
           
(package private)  int lengthOfData
           
(package private)  boolean open
           
(package private)  int SIZE
           
(package private)  URL url
           
 
Constructor Summary
HttpGetUrlRandomStream()
           
HttpGetUrlRandomStream(String s)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

open

boolean open

infile

DataInputStream infile

filename

String filename

url

URL url

con

URLConnection con

lengthOfData

int lengthOfData

count

int count

countLastRead

int countLastRead

SIZE

final int SIZE
See Also:
Constant Field Values

buffer

byte[] buffer
Constructor Detail

HttpGetUrlRandomStream

public HttpGetUrlRandomStream()

HttpGetUrlRandomStream

public HttpGetUrlRandomStream(String s)
Method Detail

getFilename

public String getFilename()
Description copied from interface: RandomStream
get the file name to be processed. this file is the raw data to be read, or the input file processed by algorithm.

Specified by:
getFilename in interface RandomStream
Returns:
string null if missing, else the filename from setFilename.
See Also:
RandomStream.getFilename()

setFilename

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

Specified by:
setFilename in interface RandomStream
Returns:
true if open (still data in stream), else flase
See Also:
RandomStream.setFilename(java.lang.String)

isOpen

public boolean isOpen()
Description copied from interface: RandomStream
check if RandomStream is open

Specified by:
isOpen in interface RandomStream
Returns:
true if open (still data in stream), else flase
See Also:
RandomStream.isOpen()

openInputStream

public boolean openInputStream()
                        throws Exception
Description copied from interface: RandomStream
open the input stream.

Specified by:
openInputStream in interface RandomStream
Returns:
boolean true for success, else false.
Throws:
Exception - - Usually IOException.
See Also:
RandomStream.openInputStream()

closeInputStream

public boolean closeInputStream()
Description copied from interface: RandomStream
close the input stream.

Specified by:
closeInputStream in interface RandomStream
Returns:
boolean true for success, else false.
See Also:
RandomStream.closeInputStream()

readByte

public byte readByte()
              throws Exception
Description copied from interface: RandomStream
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

Specified by:
readByte in interface RandomStream
Returns:
byte read form stream, -1 if passed end of file
Throws:
Exception
See Also:
RandomStream.readByte()

readInt

public int readInt()
            throws Exception
Description copied from interface: RandomStream
Processing is similar to readByte.

Specified by:
readInt in interface RandomStream
Returns:
int (32 bits, 4 bytes) read form stream, -1 if passed end of file
Throws:
Exception
See Also:
RandomStream.readInt()

readLong

public long readLong()
              throws Exception
Description copied from interface: RandomStream
Processing is similar to readByte.

Specified by:
readLong in interface RandomStream
Returns:
long (64 bits, 8 bytes) read form stream, -1 if passed end of file
Throws:
Exception
See Also:
RandomStream.readLong()

Java Randomness Test Suite

JRandTest at SourceForge

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