@Test public void WriteStringKeepOpenTest() throws IOException { try (SimpleTextWriter sfw = new SimpleTextWriter .Builder(tmpFile) .keepOpen() .build()) { sfw.write("Hello"); sfw.write("Merhaba"); sfw.write(""); sfw.write(null); } Assert.assertEquals("HelloMerhaba", new SimpleTextReader(tmpFile).asString()); }
public SimpleTextWriter write(String s) throws IOException { try { if (s == null || s.length() == 0) { return this; } writer.write(s); return this; } finally { if (!keepOpen) { close(); } } }
SimpleTextWriter implements AutoCloseable { public SimpleTextWriter write(String s) throws IOException { try { if (s == null || s.length() == 0) { return this; } writer.write(s); return this; } finally { if (!keepOpen) { close(); } } } }
SimpleTextWriter implements AutoCloseable { public SimpleTextWriter write(String s) throws IOException { try { if (s == null || s.length() == 0) { return this; } writer.write(s); return this; } finally { if (!keepOpen) { close(); } } } private  SimpleTextWriter(
      BufferedWriter writer,
      OutputStream os,
      String encoding,
      boolean keepOpen,
      boolean addNewLineBeforeClose);  SimpleTextWriter(String fileName);  SimpleTextWriter(String fileName, String encoding);  SimpleTextWriter(File file, String encoding);  SimpleTextWriter(File file); }
SimpleTextWriter implements AutoCloseable { public SimpleTextWriter write(String s) throws IOException { try { if (s == null || s.length() == 0) { return this; } writer.write(s); return this; } finally { if (!keepOpen) { close(); } } } private  SimpleTextWriter(
      BufferedWriter writer,
      OutputStream os,
      String encoding,
      boolean keepOpen,
      boolean addNewLineBeforeClose);  SimpleTextWriter(String fileName);  SimpleTextWriter(String fileName, String encoding);  SimpleTextWriter(File file, String encoding);  SimpleTextWriter(File file); static Builder builder(File file); static Builder utf8Builder(File file); static SimpleTextWriter oneShotUTF8Writer(File file); static SimpleTextWriter keepOpenUTF8Writer(File file); static SimpleTextWriter keepOpenWriter(OutputStream os, String encoding); static SimpleTextWriter oneShotWriter(OutputStream os, String encoding); static SimpleTextWriter keepOpenWriter(OutputStream os); String getEncoding(); boolean isKeepOpen(); SimpleTextWriter writeLines(Collection<String> lines); SimpleTextWriter writeLines(String... lines); SimpleTextWriter writeToStringLines(Collection<?> objects); SimpleTextWriter write(String s); SimpleTextWriter writeLine(String s); SimpleTextWriter writeLine(); SimpleTextWriter writeLine(Object obj); SimpleTextWriter copyFromStream(InputStream is); SimpleTextWriter copyFromURL(String urlStr); void close(); }
SimpleTextWriter implements AutoCloseable { public SimpleTextWriter write(String s) throws IOException { try { if (s == null || s.length() == 0) { return this; } writer.write(s); return this; } finally { if (!keepOpen) { close(); } } } private  SimpleTextWriter(
      BufferedWriter writer,
      OutputStream os,
      String encoding,
      boolean keepOpen,
      boolean addNewLineBeforeClose);  SimpleTextWriter(String fileName);  SimpleTextWriter(String fileName, String encoding);  SimpleTextWriter(File file, String encoding);  SimpleTextWriter(File file); static Builder builder(File file); static Builder utf8Builder(File file); static SimpleTextWriter oneShotUTF8Writer(File file); static SimpleTextWriter keepOpenUTF8Writer(File file); static SimpleTextWriter keepOpenWriter(OutputStream os, String encoding); static SimpleTextWriter oneShotWriter(OutputStream os, String encoding); static SimpleTextWriter keepOpenWriter(OutputStream os); String getEncoding(); boolean isKeepOpen(); SimpleTextWriter writeLines(Collection<String> lines); SimpleTextWriter writeLines(String... lines); SimpleTextWriter writeToStringLines(Collection<?> objects); SimpleTextWriter write(String s); SimpleTextWriter writeLine(String s); SimpleTextWriter writeLine(); SimpleTextWriter writeLine(Object obj); SimpleTextWriter copyFromStream(InputStream is); SimpleTextWriter copyFromURL(String urlStr); void close();  }