Class FileFormatter

java.lang.Object
io.spring.javaformat.formatter.FileFormatter

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

    • FileFormatter

      public FileFormatter()
    • FileFormatter

      public FileFormatter(JavaFormatConfig javaFormatConfig)
    • FileFormatter

      public FileFormatter(Formatter formatter)
  • Method Details

    • 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 file 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 file 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 file 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 file edits
    • formatFile

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

      public FileEdit formatFile(File file, Charset encoding, String lineSeparator)
      Format 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 file edit