Class ArrayOutput<T>

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

    public class ArrayOutput<T>
    extends java.lang.Object
    implements Output<T>
    A Java objects array output. Not thread safe.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int i  
      protected T[] items  
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayOutput​(T[] items)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      does nothing
      ArrayInput<T> getInput()
      Make a Input instance from this.
      int put​(java.util.List<T> items)  
      int put​(java.util.List<T> buffer, int from, int to)
      Bulk put of the items from the specified buffer
      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
    • Field Detail

      • items

        protected final T[] items
      • i

        protected int i
    • Constructor Detail

      • ArrayOutput

        public ArrayOutput​(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>
        Parameters:
        item - the item to put
        Throws:
        java.io.IOException - if the destination collection fails to add the item (due to capacity reasons for example)
      • put

        public int put​(java.util.List<T> buffer,
                       int from,
                       int to)
                throws java.io.IOException
        Bulk put of the items from the specified buffer
        Specified by:
        put in interface Output<T>
        Parameters:
        buffer - the buffer containing the items to put
        Returns:
        the count of the items which have been written successfully
        Throws:
        java.io.IOException - doesn't throw
      • put

        public final int put​(java.util.List<T> items)
                      throws java.io.IOException
        Specified by:
        put in interface Output<T>
        Throws:
        java.io.IOException
      • getInput

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

        public void close()
                   throws java.io.IOException
        does nothing
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException - doesn't throw
      • toString

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