Package xyz.cofe.text

Class LazyLineReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Iterable<java.lang.String>

    public class LazyLineReader
    extends java.lang.Object
    implements java.lang.Iterable<java.lang.String>, java.io.Closeable
    Отложенный /ленивый построчный итератор
    Author:
    nt.gocha@gmail.com
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int bufferSize  
      protected java.util.function.Supplier<java.io.Reader> lazyReader  
      protected java.util.concurrent.locks.Lock lock  
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyLineReader​(java.util.function.Supplier<java.io.Reader> reader)  
      LazyLineReader​(java.util.function.Supplier<java.io.Reader> reader, int bufferSize, java.util.concurrent.locks.Lock lock)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.util.Iterator<java.lang.String> iterator()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • lazyReader

        protected java.util.function.Supplier<java.io.Reader> lazyReader
      • bufferSize

        protected int bufferSize
      • lock

        protected final java.util.concurrent.locks.Lock lock
    • Constructor Detail

      • LazyLineReader

        public LazyLineReader​(java.util.function.Supplier<java.io.Reader> reader)
      • LazyLineReader

        public LazyLineReader​(java.util.function.Supplier<java.io.Reader> reader,
                              int bufferSize,
                              java.util.concurrent.locks.Lock lock)
    • Method Detail

      • iterator

        public java.util.Iterator<java.lang.String> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.String>
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException