List of utility methods to do FileOutputStream Write
void | saveFile(File f, InputStream stream) saveFile Saves a given input stream to a specified file OutputStream out = new FileOutputStream(f); int read = 0; byte[] bytes = new byte[1024]; while ((read = stream.read(bytes)) != -1) { out.write(bytes, 0, read); stream.close(); out.flush(); ... |
void | saveFile(File f, String fileName, File desDir) saveFile InputStream stream = new FileInputStream(f); OutputStream out = new FileOutputStream(desDir.getAbsolutePath() + File.separator + fileName); int bytesRead = 0; byte[] buffer = new byte[BUFFER_SIZE]; while ((bytesRead = stream.read(buffer, 0, BUFFER_SIZE)) != -1) { out.write(buffer, 0, bytesRead); stream.close(); ... |
void | saveFile(File f, String fileName, File desDir) saveFile InputStream stream = new FileInputStream(f); OutputStream out = new FileOutputStream(desDir.getAbsolutePath() + File.separatorChar + fileName); int bytesRead; byte[] buffer = new byte[BUFFER_SIZE]; while ((bytesRead = stream.read(buffer, 0, BUFFER_SIZE)) != -1) { out.write(buffer, 0, bytesRead); stream.close(); ... |
void | saveFile(File file, byte[] contenido) save File try { RandomAccessFile lObjSalida = new RandomAccessFile(file, "rw"); lObjSalida.write(contenido, 0, contenido.length); lObjSalida.close(); } catch (IOException e) { System.out.println("Error saving file at " + file + " " + e.getMessage()); throw e; |
void | saveFile(File file, InputStream is) save File OutputStream os; try { os = new BufferedOutputStream(new FileOutputStream(file)); } catch (IOException e) { throw new RuntimeException(e); pipe(is, os); |
void | saveFile(File file, String fileName, String filesDirectory) save File FileInputStream in = null; FileOutputStream out = null; File dir = new File(filesDirectory); if (!dir.exists()) dir.mkdirs(); String targetPath = dir.getPath() + File.separator + fileName; System.out.println("source file path ::" + file.getAbsolutePath()); System.out.println("saving file to ::" + targetPath); ... |
void | saveFile(File file, String savePath) save File FileInputStream inputStream = null; ByteArrayOutputStream baos = null; try { inputStream = new FileInputStream(file); baos = new ByteArrayOutputStream(); OutputStream bos = new FileOutputStream(savePath); int bytesRead = 0; byte[] buffer = new byte[8192]; ... |
void | saveFile(final byte[] bytes, final File target) save an array of bytes if (!target.exists()) { try { if (!target.createNewFile()) { throw new IllegalArgumentException( "Can't write to given target file: " + target.getAbsolutePath()); } catch (final IOException e) { throw new IllegalArgumentException("Can't write to given target file: " + target.getAbsolutePath(), ... |
boolean | saveFile(final File file, final byte[] dataToSave) save File final FileOutputStream fos = new FileOutputStream(file); fos.write(dataToSave); fos.close(); return true; |
void | saveFile(final File file, final String contents, final String encoding) Save the data, represented as a String to a file saveFile(file, contents.getBytes(encoding)); |