List of utility methods to do FileOutputStream Write
void | saveBytesToFile(byte[] str, File file) save Bytes To File FileOutputStream fos = new FileOutputStream(file);
fos.write(str);
fos.flush();
fos.close();
|
void | saveBytesToFile(String filepath, byte[] data) save Bytes To File ByteArrayInputStream is = new ByteArrayInputStream(data); java.io.FileOutputStream fos = new java.io.FileOutputStream(new File(filepath)); while (is.available() > 0) { fos.write(is.read()); fos.close(); is.close(); |
void | saveCertReqToFile(String certReq, String fileLocation) Save a certificate request in specific location FileOutputStream os = new FileOutputStream(fileLocation);
os.write(certReq.getBytes());
os.close();
|
boolean | saveColorTable(final float[][] table, final File file) Saves the given color table into the specified file. if (file == null || table == null || table.length != 3) return false; final int len = LUT_LEN / 3; final int[] b = new int[LUT_LEN]; int count = 0; for (int i = 0; i < 3; i++) { if (table[i].length != len) return false; ... |
long | saveContentToFile(DataHandler content, File outFile) Saves the specified content to the specified file long size = 0; byte[] buffer = new byte[1024]; try (InputStream is = content.getInputStream()) { try (OutputStream outStream = new FileOutputStream(outFile)) { for (int readBytes; (readBytes = is.read(buffer, 0, buffer.length)) > 0;) { size += readBytes; outStream.write(buffer, 0, readBytes); return size; |
boolean | saveData(byte[] data, String PATH, String fileName) save Data boolean ok = false; if (data != null) { try { FileOutputStream fos; File outputDir = new File(PATH); File saveFile = new File(outputDir, fileName); fos = new FileOutputStream(saveFile); fos.write(data); ... |
boolean | saveDataToFile(String filePath, byte[] data) save Data To File FileOutputStream f = null; try { f = new FileOutputStream(filePath); f.write(data); } catch (IOException e) { return false; return true; ... |
void | saveDownloadedFile(InputStream is, String destination) Saves an input stream as file BufferedOutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(new File(destination))); ByteStreams.copy(is, out); } finally { is.close(); if (out != null) { out.close(); ... |
void | saveEntry(String destPath, ZipEntry target, ZipFile zf) save Entry InputStream is = null; BufferedInputStream bis = null; FileOutputStream fos = null; BufferedOutputStream bos = null; try { File file = new File(destPath + "/" + target.getName()); if (target.isDirectory()) { file.mkdirs(); ... |
String | saveFile(byte[] fileData, String outputDir, String fileName) save File String path = outputDir + "/" + fileName; File outFile = new File(path); if (!outFile.getParentFile().exists()) { outFile.getParentFile().mkdirs(); if (!outFile.exists()) { outFile.createNewFile(); OutputStream os = new FileOutputStream(outFile); os.write(fileData); os.close(); return path; |