at.borkowski.spicej.streams

Class DelayedOutputStream

    • Constructor Detail

      • DelayedOutputStream

        public DelayedOutputStream(TickSource t,                           OutputStream real,                           long delay,                           int bufferSize)
        Constructs a new DelayedOutputStream with the given parameters.
        Parameters:
        t - The tick source to use
        real - The underlying InputStream to 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).
    • Method Detail

      • tick

        public void tick(long tick)
        Description copied from interface: TickListener
        Called when a tick event is fired. The tick sequence is given in the parameter and can be any numer - however, it is guaranteed that the number increases by one between two ticks. Integer overflows are handled naturally, ie. the tick Long.MAX_VALUE is 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.
        Specified by:
        tick in interface TickListener
        Parameters:
        tick - the tick number
      • setDelay

        public void setDelay(long delay)
        Description copied from interface: DelayShaper
        Sets a new delay in ticks. Note that bytes already waiting in queue also obey to this new delay, ie. reducing the delay will transmit all bytes waiting in queue which are due to transmission following the new delay.
        Specified by:
        setDelay in interface DelayShaper
        Parameters:
        delay - the new delay in ticks
      • getDelay

        public long getDelay()
        Description copied from interface: DelayShaper
        Returns the current delay in ticks.
        Specified by:
        getDelay in interface DelayShaper
        Returns:
        the current delay in ticks
      • getBufferSize

        public int getBufferSize()
        Returns the buffer size, real bytes
        Returns:
        the buffer size
      • getTickSource

        public TickSource getTickSource()
        Returns the TickSource this stream uses.
        Returns:
        the used tick source

Copyright © 2015. All rights reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14