APISonar


com.google.common.io.Files.append

> com > google > common > io > Files > append
com APIs google APIs common APIs io APIs Files APIs append APIs

Example 1
public void write(String content) {
        try {
            Files.append(content, file, Charset.defaultCharset());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
Example 2
private void append(String fileName) throws IOException {
    File f;
    if (!files.containsKey(fileName)) {
      f = new File(tmpDir, fileName);
      files.put(fileName, f);
    } else {
      f = files.get(fileName);
    }
    Files.append(fileName + "line\n", f, Charsets.UTF_8);
  }
Example 3
private File createTextFile(String fileName, String... lines) throws IOException {
      File file = new File(fileName);
      file.deleteOnExit();
      for (String string : lines) {
        Files.append(string, file, Charsets.UTF_8);
      }
      return file;
    }