datasource
Class NullSource

java.lang.Object
  extended by datasource.DataSource
      extended by datasource.NullSource

public class NullSource
extends DataSource

A NullSource is a source that returns zeroes, as fast as it can. It's so simple it needs no comments...

Version:
$Id: NullSource.java,v 1.6 2010/01/05 19:02:15 zahorjan Exp $

Field Summary
private  int bytesLeftToSend
          bytesLeftToSend is how many bytes remain to be sent this use of this Null source.
private  int mySize
          mySize is how many bytes this Null source should send in total.
 
Fields inherited from class datasource.DataSource
CLOSED, CONNECTED, STARTING, state
 
Constructor Summary
NullSource(int bytesToSend)
           
 
Method Summary
protected  int readFromSrc(byte[] buf, int len)
          We're a null source, so we don't actually read anything.
 void reInit()
          All derived classes must be capable of reinitializing themselves.
 
Methods inherited from class datasource.DataSource
read, readyToRead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mySize

private int mySize
mySize is how many bytes this Null source should send in total.


bytesLeftToSend

private int bytesLeftToSend
bytesLeftToSend is how many bytes remain to be sent this use of this Null source.

Constructor Detail

NullSource

public NullSource(int bytesToSend)
Method Detail

reInit

public void reInit()
Description copied from class: DataSource
All derived classes must be capable of reinitializing themselves.

Specified by:
reInit in class DataSource

readFromSrc

protected int readFromSrc(byte[] buf,
                          int len)
We're a null source, so we don't actually read anything. We just indicate whether or not all the bytes we represented have been consumed.

Specified by:
readFromSrc in class DataSource