List of utility methods to do FileOutputStream Create
void | writeFile(final String filename, final byte[] data) Writes data to a file. if (filename.equals("-")) { System.out.write(data); return; try (final OutputStream stream = new FileOutputStream(filename)) { stream.write(data); |
void | writeFile(final String fileNamePath, final byte[] daten) write File FileOutputStream output = null; try { output = new FileOutputStream(fileNamePath); output.write(daten); } finally { if (output != null) { output.close(); |
void | writeFile(InputStream in, File file) Saves an Input Stream to a file. FileOutputStream out = new FileOutputStream(file); byte[] buffer = new byte[1024]; int len = in.read(buffer); while (len != -1) { out.write(buffer, 0, len); len = in.read(buffer); out.close(); ... |
void | writeFile(InputStream inputFile, String path, String fullFileName) Writes an file in a specific folder in the web server. File file = new File(path + fullFileName); OutputStream outputFile = new FileOutputStream(file); byte buf[] = new byte[1024]; int length; while ((length = inputFile.read(buf)) > 0) { outputFile.write(buf, 0, length); inputFile.close(); ... |
File | writeFile(InputStream inputStream, String filename, long lastModified) Write a file to disk File file = new File(filename); file.createNewFile(); OutputStream out = new FileOutputStream(file); byte[] bytes = new byte[4096]; for (int len; (len = inputStream.read(bytes)) > 0;) { out.write(bytes, 0, len); out.flush(); ... |
void | writeFile(InputStream is, File file) write File file.getParentFile().mkdirs(); try (FileOutputStream fos = new FileOutputStream(file)) { final byte data[] = new byte[1024]; int count; while ((count = is.read(data, 0, 1024)) != -1) { fos.write(data, 0, count); |
void | writeFile(InputStream is, File outFile) write File BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(new FileOutputStream(outFile)); byte[] buffer = new byte[4096]; int len; BufferedInputStream bis = new BufferedInputStream(is); while ((len = bis.read(buffer)) != -1) { bos.write(buffer, 0, len); ... |
void | writeFile(InputStream srcStream, File destFile) write File File testFile = destFile.getParentFile(); if (!testFile.exists()) testFile.mkdirs(); FileOutputStream destStream = new FileOutputStream(destFile); byte[] buf = new byte[65535]; int bytesRead; while (true) { bytesRead = srcStream.read(buf); ... |
void | writeFile(InputStream stream, File to) Create a file with the contents of this data stream. if (to.exists()) { throw new IOException("File '" + to.getAbsolutePath() + "' already exists."); File parent = to.getParentFile(); if (!parent.exists()) { parent.mkdirs(); if (!parent.exists()) { throw new IOException("Can't create parent directory for '" + to.getAbsolutePath() + "'"); ... |
void | writeFile(List write File try (FileOutputStream file = new FileOutputStream(filename)) { byte[] bytes = new byte[data.size()]; for (int i = 0; i < bytes.length; i++) bytes[i] = data.get(i); file.write(bytes); } catch (IOException e) { throw new RuntimeException(e); |