Class CircularListOutput<T>

  • All Implemented Interfaces:
    Output<T>, java.io.Closeable, java.lang.AutoCloseable

    public class CircularListOutput<T>
    extends ListOutput<T>
    The items output which may be written infinitely.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int capacity  
      protected int i  
      • Fields inherited from class com.github.akurilov.commons.io.collection.ListOutput

        items
    • Constructor Summary

      Constructors 
      Constructor Description
      CircularListOutput​(java.util.List<T> itemList, int capacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CircularListInput<T> getInput()
      Make a Input instance from this.
      int put​(java.util.List<T> buffer, int from, int to)
      Bulk circular put method
      boolean put​(T item)
      Write the data item
      java.lang.String toString()  
      • Methods inherited from class com.github.akurilov.commons.io.collection.ListOutput

        close, put
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • capacity

        protected int capacity
      • i

        protected int i
    • Constructor Detail

      • CircularListOutput

        public CircularListOutput​(java.util.List<T> itemList,
                                  int capacity)
                           throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
    • Method Detail

      • put

        public boolean put​(T item)
                    throws java.io.IOException
        Description copied from interface: Output
        Write the data item
        Specified by:
        put in interface Output<T>
        Overrides:
        put in class ListOutput<T>
        Parameters:
        item - the item to put
        Throws:
        java.io.IOException - if the destination collection fails to add the item
      • put

        public int put​(java.util.List<T> buffer,
                       int from,
                       int to)
                throws java.io.IOException
        Bulk circular put method
        Specified by:
        put in interface Output<T>
        Overrides:
        put in class ListOutput<T>
        Parameters:
        buffer - the list of the items to put in a batch mode
        Returns:
        the size of the buffer to put
        Throws:
        java.io.IOException - if the destination collection fails to add the items
      • getInput

        public CircularListInput<T> getInput()
                                      throws java.io.IOException
        Description copied from interface: Output
        Make a Input instance from this.
        Specified by:
        getInput in interface Output<T>
        Overrides:
        getInput in class ListOutput<T>
        Returns:
        the corresponding input
        Throws:
        java.io.IOException - doesn't throw
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class ListOutput<T>