Class FileFormatter


  • public class FileFormatter
    extends Object
    A code formatter designed to work with Files.
    Author:
    Phillip Webb
    See Also:
    Formatter
    • Constructor Detail

      • FileFormatter

        public FileFormatter()
      • FileFormatter

        public FileFormatter​(Formatter formatter)
    • Method Detail

      • formatFiles

        public Stream<FileEdit> formatFiles​(Iterable<File> files,
                                            Charset encoding)
        Format the given source files and provide a Stream of FileEdit instances.
        Parameters:
        files - the files to format
        encoding - the source encoding
        Returns:
        a stream of formatted files that have edits
      • formatFiles

        public Stream<FileEdit> formatFiles​(Iterable<File> files,
                                            Charset encoding,
                                            String lineSeparator)
        Format the given source files and provide a Stream of FileEdit instances.
        Parameters:
        files - the files to format
        encoding - the source encoding
        lineSeparator - the line separator
        Returns:
        a stream of formatted files that have edits
      • formatFiles

        public Stream<FileEdit> formatFiles​(Stream<File> files,
                                            Charset encoding)
        Format the given source files and provide a Stream of FileEdit instances.
        Parameters:
        files - the files to format
        encoding - the source encoding
        Returns:
        a stream of formatted files that have edits
      • formatFiles

        public Stream<FileEdit> formatFiles​(Stream<File> files,
                                            Charset encoding,
                                            String lineSeparator)
        Format the given source files and provide a Stream of FileEdit instances.
        Parameters:
        files - the files to format
        encoding - the source encoding
        lineSeparator - the line separator
        Returns:
        a stream of formatted files that have edits
      • formatFile

        public FileEdit formatFile​(File file,
                                   Charset encoding)
        Format the the given source file and return a FileEdit instance.
        Parameters:
        file - the file to format
        encoding - the source encoding
        Returns:
        a formatted file
      • formatFile

        public FileEdit formatFile​(File file,
                                   Charset encoding,
                                   String lineSeparator)
        Format the the given source file and return a FileEdit instance.
        Parameters:
        file - the file to format
        encoding - the source encoding
        lineSeparator - the line separator
        Returns:
        a formatted file