Class PathFileCodec

  • All Implemented Interfaces:
    FileCodec

    public final class PathFileCodec
    extends java.lang.Object
    implements FileCodec
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static PathFileCodec instance()  
      static PathFileCodec of​(java.lang.String path)  
      static PathFileCodec of​(java.nio.file.Path path)  
      java.lang.String read​(java.lang.String file)
      Reads the specified file
      void write​(java.lang.String file, java.lang.String content)
      Writes the provided data to the specified file
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • of

        public static PathFileCodec of​(java.nio.file.Path path)
      • read

        public java.lang.String read​(java.lang.String file)
        Description copied from interface: FileCodec
        Reads the specified file
        Specified by:
        read in interface FileCodec
        Parameters:
        file - the file to read
        Returns:
        a list of all the lines in the specified file, or null when the file does not exist
      • write

        public void write​(java.lang.String file,
                          java.lang.String content)
        Description copied from interface: FileCodec
        Writes the provided data to the specified file
        Specified by:
        write in interface FileCodec
        Parameters:
        file - the file to write to
        content - the data to write