List of utility methods to do FileOutputStream Write
boolean | saveStringIntoFile(String filePath, String contents) save String Into File File file = new File(filePath); try { new FileOutputStream(file).write(contents.getBytes()); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); ... |
void | saveStringsList(String file, Collection save Strings List saveStringsList(file, c, false); |
void | saveStringToFile(File file, String content, String charset) Saves specified content to the file with specified charset. FileOutputStream out = new FileOutputStream(file); byte[] data = content.getBytes(charset); out.write(data); out.flush(); out.close(); |
File | saveTemp(final byte[] data, final String suffix) save Temp final File tempFile = File.createTempFile("afirma", suffix); tempFile.deleteOnExit(); if (saveFile(tempFile, data)) { return tempFile; return null; |
void | saveTempFile(String xmlSource, String fileName) save Temp File if (fileName.isEmpty()) { fileName = "MissingId"; File adhoc = new File(PATH + fileName + ".xml"); if (adhoc.exists()) { adhoc.delete(); adhoc.createNewFile(); ... |
void | saveTextContentInFile(String content, File file) save Text Content In File FileOutputStream fos = null; try { fos = new FileOutputStream(file); fos.write(content.getBytes("UTF-8")); fos.flush(); } catch (Exception e) { throw new RuntimeException("Cannot add the content into temp file " + file.getAbsolutePath(), e); } finally { ... |
void | saveTextToFile(String fileName, String content) save Text To File if (content == null) { System.out.println("File not saved, content is null " + fileName); return; FileOutputStream fop = null; File file; try { file = new File(fileName); ... |
void | saveTo(InputStream in, String fileName) save To saveTo(in, new File(fileName));
|
void | saveTo(String path, InputStream in) Saves content read from input stream into a file. if (in == null) throw new IllegalArgumentException("input stream cannot be null"); if (path == null) throw new IllegalArgumentException("path cannot be null"); FileOutputStream out = new FileOutputStream(path); try { byte[] bytes = new byte[1024]; for (int x = in.read(bytes); x != -1; x = in.read(bytes)) ... |
void | saveTo(String path, InputStream in) Saves content read from input stream into a file. if (in == null) { throw new IllegalArgumentException("input stream cannot be null"); if (path == null) { throw new IllegalArgumentException("path cannot be null"); FileOutputStream out = null; try { ... |