List of utility methods to do Text File Write
void | writeString(final ObjectOutput out, final String s) write String final int len = s.length(); out.writeInt(len); for (int i = 0; i < len; i++) { int v = s.charAt(i); out.write((v >>> 8) & 0xFF); out.write((v >>> 0) & 0xFF); |
int | writeString(final String data, final int length, final byte[] destination, int offset) write String requireDestinationLength(destination, offset, length); byte[] src; try { src = data.getBytes("UTF-8"); } catch (UnsupportedEncodingException uee) { System.err.println(uee + "\nSwitching to default encoding"); src = data.getBytes(); for (int i = 0; i < length; ++i) { destination[offset + i] = i < src.length - 1 ? src[i] : 0; return length; |
void | writeString(final String output, final String fileName) Writes string to file PrintWriter out = new PrintWriter(fileName, "US-ASCII"); out.print(output); out.close(); |
void | writeString(final String s, final File f) Writes the specified string to the specified file. assureParentsExist(f); PrintWriter pw = null; try { pw = new PrintWriter(f); pw.write(s); } catch (final IOException e) { throw new RuntimeException(e); } finally { ... |
boolean | writeString(String a, String MyFilePath) write String boolean tag = true; try { FileWriter writer = new FileWriter(MyFilePath, true); BufferedWriter bufWriter = new BufferedWriter(writer); bufWriter.write(a); bufWriter.newLine(); bufWriter.close(); writer.close(); ... |
void | writeString(String content, String path, String charset) write String PrintWriter writer = null; try { writer = getPrintWriter(path, charset, false); writer.print(content); } finally { close(writer); |
void | writeString(String contents, File file) write String FileWriter out = new FileWriter(file); try { out.write(contents); } finally { out.close(); |
void | writeString(String contents, File file) write String FileWriter out = new FileWriter(file); try { out.write(contents); } finally { out.close(); |
boolean | writeString(String data, File file) Writes a String to disk. try { PrintWriter out = new PrintWriter(new FileWriter(file)); out.print(data); out.close(); return true; } catch (IOException e) { System.out.println("Problem writing String to disk!"); e.printStackTrace(); ... |
void | writeString(String data, String file_path) write String try { FileOutputStream out_s = new FileOutputStream(file_path); out_s.write(data.getBytes()); out_s.close(); } catch (Exception e) { e.printStackTrace(); |