public void applyFormat(File file) throws IOException {
  byte[] rawBytes=Files.readAllBytes(file.toPath());
  String raw=new String(rawBytes,encoding);
  String rawUnix=LineEnding.toUnix(raw);
  String formattedUnix=applySteps(rawUnix,file);
  String formatted=applyLineEndings(formattedUnix,file);
  byte[] formattedBytes=formatted.getBytes(encoding);
  if (!Arrays.equals(rawBytes,formattedBytes)) {
    Files.write(file.toPath(),formattedBytes,StandardOpenOption.TRUNCATE_EXISTING);
  }
}

public void applyFormat ( File file ) throws IOException { byte [ ] rawBytes = Files . readAllBytes ( file . toPath ( ) ) ; String raw = new String ( rawBytes , encoding ) ; String rawUnix = LineEnding . toUnix ( raw ) ; String formattedUnix = applySteps ( rawUnix , file ) ; String formatted = applyLineEndings ( formattedUnix , file ) ; byte [ ] formattedBytes = formatted . getBytes ( encoding ) ; if ( ! Arrays . equals ( rawBytes , formattedBytes ) ) { Files . write ( file . toPath ( ) , formattedBytes , StandardOpenOption . TRUNCATE_EXISTING ) ; } }
applies formatting to the given file .
