Code example for FileOutputStream

Methods: close, write

0
		pumpStream(in, out, null);
		return out.toByteArray();
	} 
	 
	public static void writeByteArrayToFile(File file, byte[] bytes) throws IOException {
		FileOutputStream fout = new FileOutputStream(file);
		try { 
			fout.write(bytes);
		} finally { 
			fout.close();
		} 
	} 
	 
	public static void copyFile(File src, File dest) throws IOException {
		InputStream in = new FileInputStream(src);
		OutputStream out = new FileOutputStream(dest);
		byte[] buf = new byte[1024];
		int len;
		while ((len = in.read(buf)) > 0) {
		   out.write(buf, 0, len);
		}