Class TextFile

  • All Implemented Interfaces:
    Direct Known Subclasses:

    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

      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.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)
    • 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.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()
        toString in class java.lang.Object