org.xnap.io
Class ThrottledOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.xnap.io.ThrottledOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, BandwidthManagable

public class ThrottledOutputStream
extends java.io.FilterOutputStream
implements BandwidthManagable

The global throtteled OutputStream. All uploads should pipe their data through this stream.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ThrottledOutputStream(java.io.OutputStream out)
           
 
Method Summary
 void close()
           
 int getPriority()
          Returns a priority for this download.
 void setAllocated(long bytes)
          Sets the number of allocated bytes that the Managable is allowed to send.
 void write(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.FilterOutputStream
flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThrottledOutputStream

public ThrottledOutputStream(java.io.OutputStream out)
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException

getPriority

public int getPriority()
Description copied from interface: BandwidthManagable
Returns a priority for this download.

Specified by:
getPriority in interface BandwidthManagable
Returns:
must never return a value < 0

setAllocated

public void setAllocated(long bytes)
Description copied from interface: BandwidthManagable
Sets the number of allocated bytes that the Managable is allowed to send.

Specified by:
setAllocated in interface BandwidthManagable

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException


Copyright © 2001-2005 XNap Team. All Rights Reserved.