Class CsvItemInput<I extends Item>

  • All Implemented Interfaces:
    com.github.akurilov.commons.io.Input<I>, java.lang.AutoCloseable, java.util.function.Supplier<I>
    Direct Known Subclasses:
    CsvFileItemInput

    public class CsvItemInput<I extends Item>
    extends java.lang.Object
    implements com.github.akurilov.commons.io.Input<I>
    The data item input using CSV file containing the human-readable data item records as the source
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ItemFactory<I> itemFactory  
      protected java.io.BufferedReader itemsSrc  
      • Fields inherited from interface com.github.akurilov.commons.io.Input

        DELIMITER
    • 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)  
      void reset()
      Most probably will cause an IOException due to missing mark
      protected void setItemsSrc​(java.io.BufferedReader itemsSrc)  
      long skip​(long itemsCount)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • itemsSrc

        protected java.io.BufferedReader itemsSrc
    • Constructor Detail

      • CsvItemInput

        public CsvItemInput​(java.io.InputStream in,
                            ItemFactory<I> itemFactory)
        Parameters:
        in - the input stream to get the data item records from
        itemFactory - the concrete item factory used to parse the records
        Throws:
        java.io.IOException
        java.lang.NoSuchMethodException
      • CsvItemInput

        protected CsvItemInput​(java.io.BufferedReader itemsSrc,
                               ItemFactory<I> itemFactory)
    • Method Detail

      • setItemsSrc

        protected final void setItemsSrc​(java.io.BufferedReader itemsSrc)
      • skip

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

        public 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 int get​(java.util.List<I> buffer,
                       int limit)
        Specified by:
        get in interface com.github.akurilov.commons.io.Input<I extends Item>
      • reset

        public void reset()
        Most probably will cause an IOException due to missing mark
        Specified by:
        reset in interface com.github.akurilov.commons.io.Input<I extends Item>
        Throws:
        java.io.IOException
      • close

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

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