Class DelayedTransferConvertBuffer<I extends Item,​O extends Operation<I>>

  • All Implemented Interfaces:
    TransferConvertBuffer<I,​O>, com.github.akurilov.commons.io.Input<I>, com.github.akurilov.commons.io.Output<O>, java.lang.AutoCloseable, java.util.function.Consumer<O>, java.util.function.Supplier<I>

    public final class DelayedTransferConvertBuffer<I extends Item,​O extends Operation<I>>
    extends java.lang.Object
    implements TransferConvertBuffer<I,​O>
    Created by kurila on 16.01.17.
    • Field Summary

      • Fields inherited from interface com.github.akurilov.commons.io.Input

        DELIMITER
    • Constructor Summary

      Constructors 
      Constructor Description
      DelayedTransferConvertBuffer​(int limit, long delay, java.util.concurrent.TimeUnit timeUnit)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      I get()  
      int get​(java.util.List<I> buffer, int limit)  
      com.github.akurilov.commons.io.Input<O> getInput()
      Don't use this method, it will cause the assertion error
      int put​(java.util.List<O> ioResults)
      Block until all the given items are consumed
      int put​(java.util.List<O> ioResults, int from, int to)
      Block until all the items from the given range are consumed
      boolean put​(O ioResult)
      Block until the free space in the buff is available
      void reset()  
      long skip​(long count)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.function.Consumer

        andThen
      • Methods inherited from interface com.github.akurilov.commons.io.Output

        accept
    • Constructor Detail

      • DelayedTransferConvertBuffer

        public DelayedTransferConvertBuffer​(int limit,
                                            long delay,
                                            java.util.concurrent.TimeUnit timeUnit)
    • Method Detail

      • put

        public final boolean put​(O ioResult)
        Block until the free space in the buff is available
        Specified by:
        put in interface com.github.akurilov.commons.io.Output<I extends Item>
        Parameters:
        ioResult -
        Returns:
        always true
        Throws:
        java.io.IOException
      • put

        public final int put​(java.util.List<O> ioResults,
                             int from,
                             int to)
        Block until all the items from the given range are consumed
        Specified by:
        put in interface com.github.akurilov.commons.io.Output<I extends Item>
        Parameters:
        ioResults -
        from -
        to -
        Returns:
        Throws:
        java.io.IOException
      • put

        public final int put​(java.util.List<O> ioResults)
        Block until all the given items are consumed
        Specified by:
        put in interface com.github.akurilov.commons.io.Output<I extends Item>
        Parameters:
        ioResults -
        Returns:
        Throws:
        java.io.IOException
      • getInput

        public final com.github.akurilov.commons.io.Input<O> getInput()
        Don't use this method, it will cause the assertion error
        Specified by:
        getInput in interface com.github.akurilov.commons.io.Output<I extends Item>
      • get

        public final I get()
        Specified by:
        get in interface com.github.akurilov.commons.io.Input<I extends Item>
        Specified by:
        get in interface java.util.function.Supplier<I extends Item>
      • get

        public final int get​(java.util.List<I> buffer,
                             int limit)
        Specified by:
        get in interface com.github.akurilov.commons.io.Input<I extends Item>
      • skip

        public final long skip​(long count)
        Specified by:
        skip in interface com.github.akurilov.commons.io.Input<I extends Item>
      • reset

        public final void reset()
        Specified by:
        reset in interface com.github.akurilov.commons.io.Input<I extends Item>
      • close

        public final void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object