nl.uva.vlet.vfs
Class CircularStreamBufferTransferer

java.lang.Object
  extended by nl.uva.vlet.vfs.CircularStreamBufferTransferer

public class CircularStreamBufferTransferer
extends java.lang.Object

CircularStreamBufferTransferer copies data from InputStream to OutputStream. Uses circular buffer to transfer bytes from inputstream to output stream. This streambuffer is optimized for big files and big transfer speeds. Both SRB and GTFP have optimizated transfer methods which work best when transfering big buffers (in the read/write methods). So the interal buffer should be between 1 and 10 MB.


Constructor Summary
CircularStreamBufferTransferer(int size)
           
 
Method Summary
 void readLoop()
           
 void setInputStream(java.io.InputStream inp)
           
 void setMaxReadChunkSize(int size)
          Limits the nr of bytes thats get read each read iteration.
 void setMaxWriteChunkSize(int size)
          Limits the nr of bytes thats get written each write iteration.
 void setOutputstream(java.io.OutputStream outp)
           
 void setStop(boolean val)
           
 void setTransferInfo(VFSTransfer transfer)
           
 void startTransfer(long numTransfer)
          Transfer upto numTranfer bytes, or -1 for all
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CircularStreamBufferTransferer

public CircularStreamBufferTransferer(int size)
Method Detail

setOutputstream

public void setOutputstream(java.io.OutputStream outp)

setInputStream

public void setInputStream(java.io.InputStream inp)

setMaxWriteChunkSize

public void setMaxWriteChunkSize(int size)
Limits the nr of bytes thats get written each write iteration. If the OutputStream can not efficiently (or not at all!) handle big writes, limit the maximum with this method.


setMaxReadChunkSize

public void setMaxReadChunkSize(int size)
Limits the nr of bytes thats get read each read iteration. If the InputStream can not efficiently (or not at all!) handle big reads, limit the maximum with this method. Usually the 'read()' method already reads the nr. bytes it can handle per read (which it returns).


readLoop

public void readLoop()
              throws VlException
Throws:
VlException

setStop

public void setStop(boolean val)

startTransfer

public void startTransfer(long numTransfer)
                   throws VlException
Transfer upto numTranfer bytes, or -1 for all

Throws:
VlException

setTransferInfo

public void setTransferInfo(VFSTransfer transfer)