List of utility methods to do Text File Write
void | writeString(StringBuilder out, CharSequence value, boolean escapeXML) Encodes a String in JavaScript Object Notation. if (value == null) { out.append("null"); } else { out.append('\''); for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); _escapeChar(out, ch, escapeXML); out.append('\''); |
void | writeStringField(String name, String value, JsonGenerator jgen) write String Field if (value != null) {
jgen.writeStringField(name, value);
|
void | writeStringFile(String FileName, String text) Write text to a file called Filename try { FileOutputStream fs = new FileOutputStream(FileName); PrintStream out = new PrintStream(fs); out.println(text); out.close(); } catch (IOException ex) { throw new IllegalArgumentException(ex.toString()); |
void | writeStringInto(String s, File outputFile) Writes a string into a file. InputStream in = new ByteArrayInputStream(s.getBytes("UTF-8")); copyStream(in, outputFile); |
void | writeStringInto(String s, File outputFile) Writes a string into a file. InputStream in = new ByteArrayInputStream(s.getBytes("UTF-8")); copyStream(in, outputFile); |
void | writeStringListToFile(File file, ArrayList Writes a string list to a file. if (file == null) { throw new IllegalArgumentException("File should not be null."); if (!file.exists()) { throw new FileNotFoundException("File does not exist: " + file); if (!file.isFile()) { throw new IllegalArgumentException("Should not be a directory: " + file); ... |
void | writeStringListToFile(File file, List Writes a string list to a file. if (file == null) { throw new IllegalArgumentException("File should not be null."); try (BufferedWriter output = new BufferedWriter(new FileWriter(file))) { for (String line : lines) { output.write(line + "\n"); |
void | writeStringTo(File outFile, String data) write String To FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(outFile); outputStream.write(data.getBytes()); outputStream.flush(); } finally { if (outputStream != null) { outputStream.close(); ... |
void | writeStringTo(String _value, File _target) write String To BufferedWriter writer = new BufferedWriter(new FileWriter(_target)); try { if (null != _value) writer.write(_value); } finally { writer.close(); |
void | writeStringToFile(@Nonnull String string, @Nonnull final File file) Writes a String to a File . checkNotNull(string, "string cannot be null."); checkNotNull(file, "file cannot be null."); try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), "UTF-8")) { string = string.replaceAll("\n", System.getProperty("line.separator")); out.write(string); |