List of utility methods to do FileOutputStream Create
FileOutputStream | getOutputStream(String filename, String dir) get an output stream for a file String fullFN = null; if (null != dir) { fullFN = dir + "/" + filename; new File(dir).mkdirs(); } else { fullFN = filename; return new FileOutputStream(fullFN); ... |
OutputStreamWriter | getOutputStream(String fname, String enc, boolean append) Caller is responsible for write flush, close, etc. return new OutputStreamWriter(new FileOutputStream(fname, append), enc); |
DataOutputStream | getOutputStream(String path) Opens an output stream for the specified path. return new DataOutputStream(new FileOutputStream(path)); |
OutputStream | getOutputStream(String path) get Output Stream return new FileOutputStream(touch(path)); |
OutputStream | getOutputStream(String root, String name, boolean overwrite, boolean verbose) get Output Stream if (root != null) { File directory = new File(root); if (!directory.exists()) { if (!directory.mkdirs()) { throw new IOException("Failed to create directory '" + root + "'."); } else if (verbose) { System.out.println("Created directory '" + directory.getAbsolutePath() + "'."); File file = new File(root, name); String absolutePath = file.getAbsolutePath(); if (file.exists()) { if (!overwrite) { throw new IOException("File '" + absolutePath + "' already exists. " + "Please remove it or enable the " + "overwrite option."); } else { file.delete(); if (verbose) { System.out.println("Deleted file '" + absolutePath + "'."); FileOutputStream fos = new FileOutputStream(absolutePath); if (verbose) { System.out.println("Created file '" + absolutePath + "'."); return fos; |
OutputStream | getOutputStream(String theFilePath) get Output Stream try { final OutputStream myOutputStream = new FileOutputStream(theFilePath); return myOutputStream; } catch (FileNotFoundException ex) { ex.printStackTrace(); return null; |
OutputStream | getOutputStreamForFile(final File file) Reads a file an returns an OutputStream from it.
return new FileOutputStream(file); |
OutputStream | getOutputStreamForFile(String filename) get Output Stream For File try { File file = new File(filename); if (!file.exists()) { file.createNewFile(); return new FileOutputStream(file); } catch (IOException e) { throw new IllegalStateException(e); ... |
void | writeFile(File outFile, ZipInputStream zipInputStream, ZipEntry entry) Write data. try { if (entry.isDirectory()) { return; BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outFile)); int data = 0; try { while ((data = zipInputStream.read()) != -1) { ... |
boolean | writeFile(FileOutputStream fileoutputstream, byte abyte0[], int i) write File try { fileoutputstream.write(abyte0, 0, i); return true; } catch (IOException ex) { System.err.println("File cannot be written."); return false; |