List of utility methods to do FileOutputStream Write
void | saveIntArrayToFile(int[] array, File file) save Int Array To File try { FileOutputStream fos = new FileOutputStream(file); DataOutputStream dos = new DataOutputStream(fos); for (int i : array) { dos.writeInt(i); dos.close(); fos.close(); ... |
void | saveKeyToFile(String key) save Key To File try { FileOutputStream out = new FileOutputStream("/home/junior/antinsa.keystore"); BufferedReader c = new BufferedReader(new StringReader(key)); int b; while ((b = c.read()) > -1) { out.write(b); c.close(); ... |
void | saveLongList(String file, Collection save Long List File p = new File(file).getParentFile(); if (p != null) p.mkdirs(); FileOutputStream fout = new FileOutputStream(file, append); try { for (Long subjectID : c) { fout.write((subjectID + "\n").getBytes()); } finally { fout.close(); |
boolean | saveProxyClass(String path, String proxyClassName, Class[] interfaces) Save proxy class to path if (proxyClassName == null || path == null) { return false; byte[] classFile = ProxyGenerator.generateProxyClass(proxyClassName, interfaces); FileOutputStream out = null; try { out = new FileOutputStream(path); out.write(classFile); ... |
void | saveResouce(String resourceName, String outputFile) save Resouce InputStream input = resourceName.getClass().getResourceAsStream(resourceName);
OutputStream output;
output = new FileOutputStream(outputFile);
writeFile(input, output);
output.flush();
output.close();
|
void | saveStream(InputStream is, File output) save Stream byte[] buf = new byte[1024]; int cnt; try (FileOutputStream fos = new FileOutputStream(output)) { while ((cnt = is.read(buf)) > 0) { fos.write(buf, 0, cnt); fos.flush(); |
void | saveStream(InputStream stream, File targetFile) Saves the data from an InputStream into a file. BufferedOutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(targetFile), 0x4000); pipeStreams(stream, out); } finally { try { if (out != null) { out.close(); ... |
void | saveStreamToFile(InputStream in, File outFile) save Stream To File FileOutputStream out = null; try { out = new FileOutputStream(outFile); byte[] buf = new byte[4096]; int bytes_read; while ((bytes_read = in.read(buf)) != -1) out.write(buf, 0, bytes_read); } finally { ... |
boolean | saveStreamToFile(InputStream is, File destFile) save Stream To File FileOutputStream fos = new FileOutputStream(destFile); int readLen = 0; byte[] buf = new byte[1024]; while ((readLen = is.read(buf)) != -1) { System.out.println(readLen); fos.write(buf, 0, readLen); fos.flush(); ... |
void | saveStringIntoFile(File file, String contents) save a string into a file, file does not have to exist try { writeStringToFile(file, contents, "ISO-8859-1"); } catch (IOException ioe) { throw new RuntimeException(ioe); |