|Constructor and Description|
Constructs a new
|Modifier and Type||Method and Description|
Returns the underlying
Returns the buffer size, real bytes
Returns the current delay in ticks.
Sets a new delay in ticks.
Called when a tick event is fired.
public DelayedOutputStream(TickSource t, OutputStream real, long delay, int bufferSize)
DelayedOutputStreamwith the given parameters.
t- The tick source to use
real- The underlying
InputStreamto read data from
delay- The delay (real ticks) to introduce to data
bufferSize- The buffer size to use. The implementation has to store read bytes real an intermediate buffer. The buffer must be large enough to store the data. Note that data which cannot be stored into the buffer because of its overflow will have a higher delay, which is why the buffer should be significantly higher than the expected data arrivel rate (times the expected interval of reading from this stream).
public void write(int b) throws IOException
public void write(byte b, int off, int len) throws IOException
public void tick(long tick)
Long.MAX_VALUEis followed by
Long.MIN_VALUE. Furthermore, it is guaranteed that ticks do not overlap each other, ie. no two threads will enter the same object's
TickListener.tick(long)at the same time.
public void write(byte b) throws IOException
public void close() throws IOException
public void setDelay(long delay)
public long getDelay()
public int getBufferSize()
public OutputStream getBaseStream()
Copyright © 2015. All rights reserved.