List of utility methods to do OutputStream Write
void | copyFile(File fromFile, File toFile) copy File System.out.println("cp " + fromFile.getName() + " " + toFile.getName()); Runtime.getRuntime().exec("cp " + fromFile.getAbsolutePath() + " " + toFile.getAbsolutePath()); |
void | copyFile(final InputStream in, final OutputStream out, final int size) Copy a file from one location to another try { final byte[] buffer = new byte[size]; int length; while ((length = in.read(buffer)) > 0) out.write(buffer, 0, length); } catch (final Exception e) { e.printStackTrace(); } finally { ... |
void | copyFile(InputStream in, OutputStream out) copy File byte[] buffer = new byte[10240]; int len; while ((len = in.read(buffer)) >= 0) { out.write(buffer, 0, len); |
int | copyFile(InputStream in, OutputStream out, boolean close) copy File int size = 0; int b = in.read(); while (b != -1) { size++; out.write(b); b = in.read(); in.close(); ... |
void | copyFile(InputStream inputStream, OutputStream outputStream) Copies a file from the given streams. byte[] buf = new byte[1024]; int i = 0; while ((i = inputStream.read(buf)) != -1) { outputStream.write(buf, 0, i); |
void | copyFile(OutputStream os, InputStream is) Copies the inputstream to the output stream. byte[] buf = new byte[8192]; int sz; while (0 < (sz = is.read(buf))) os.write(buf, 0, sz); |
void | copyFile(String fileName, String newFileName) copy File Files.copy(new File(fileName), new File(newFileName)); |
void | copyFilePermissions(File source, File target) Sets the file permissions of the given source file on the given target file. if (source.canRead()) { target.setReadable(true, false); } else { target.setReadable(false, false); if (source.canWrite()) { target.setWritable(true, false); } else { ... |
void | serialize(java.io.Serializable serializable, java.io.ObjectOutputStream oos) serialize try { oos.writeObject(serializable); } catch (java.io.IOException ioe) { throw new RuntimeException(ioe); |
void | serialize(Object o, OutputStream out) Serializes the given object to the given output stream. ObjectOutputStream oout = new ObjectOutputStream(out); try { oout.writeObject(o); } finally { if (oout != null) { oout.close(); |