Class TextFile

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>
    Direct Known Subclasses:
    StartIni

    public class TextFile
    extends java.lang.Object
    implements java.lang.Iterable<java.lang.String>
    Simple common abstraction for Text files, that consist of a series of lines.

    Ignoring lines that are empty, deemed to be comments, or are duplicates of prior lines.

    • Constructor Summary

      Constructors 
      Constructor Description
      TextFile​(java.nio.file.Path file)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addUniqueLine​(java.lang.String line)  
      java.util.List<java.lang.String> getAllLines()  
      java.nio.file.Path getFile()  
      java.util.List<java.lang.String> getLineMatches​(java.util.regex.Pattern pattern)  
      java.util.List<java.lang.String> getLines()  
      void init()  
      java.util.Iterator<java.lang.String> iterator()  
      java.util.ListIterator<java.lang.String> listIterator()  
      void process​(java.lang.String line)  
      java.util.stream.Stream<java.lang.String> stream()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

        forEach, spliterator
    • Constructor Detail

      • TextFile

        public TextFile​(java.nio.file.Path file)
                 throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • addUniqueLine

        public void addUniqueLine​(java.lang.String line)
      • getFile

        public java.nio.file.Path getFile()
      • getLineMatches

        public java.util.List<java.lang.String> getLineMatches​(java.util.regex.Pattern pattern)
      • getLines

        public java.util.List<java.lang.String> getLines()
      • getAllLines

        public java.util.List<java.lang.String> getAllLines()
      • init

        public void init()
      • stream

        public java.util.stream.Stream<java.lang.String> stream()
      • iterator

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

        public java.util.ListIterator<java.lang.String> listIterator()
      • process

        public void process​(java.lang.String line)
      • toString

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