Class CircularArrayOutput<T>

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

    public class CircularArrayOutput<T>
    extends ArrayOutput<T>
    An array output which may use fixed space for unlimited (circular) storing.
    • Field Summary

      • Fields inherited from class com.github.akurilov.commons.io.collection.ArrayOutput

        i, items
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CircularArrayInput<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 java.lang.Object

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

      • CircularArrayOutput

        public CircularArrayOutput​(T[] items)
    • 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 ArrayOutput<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 ArrayOutput<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 CircularArrayInput<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 ArrayOutput<T>
        Returns:
        the corresponding input
        Throws:
        java.io.IOException - doesn't throw