List of utility methods to do FileOutputStream Write Byte Array
FileOutputStream | writeBytes(int[] data, String filename) Writes data from the integer array to disk as raw bytes, overwriting the old file if present. FileOutputStream out = new FileOutputStream(filename, false); writeBytes(data, out); return out; |
void | writeBytes(int[] data, String filename) Writes data from the integer array to disk as raw bytes. FileOutputStream out = new FileOutputStream(filename); byte[] b = new byte[4]; for (int word : data) { for (int i = 0; i < 4; i++) { int offset = (b.length - 1 - i) * 8; b[i] = (byte) ((word >>> offset) & 0xFF); out.write(b); ... |
void | writeBytes(String filename, byte[] bytes) write Bytes FileOutputStream output = new FileOutputStream(filename);
output.write(bytes);
output.close();
|
void | writeBytes(String filename, byte[] data, int len) write Bytes if (filename == null || filename.isEmpty()) { return; try (FileOutputStream out = new FileOutputStream(filename)) { out.write(data, 0, len); |
void | writeBytes(String filePath, boolean append, byte[] content) write Bytes FileOutputStream fos = new FileOutputStream(filePath, append); try { fos.write(content); fos.flush(); } finally { fos.close(); |
void | writeBytesInFile(File f, String data) write Bytes In File writeBytesInFile(f, data.getBytes()); |
void | writeBytesSafely(File aFile, byte theBytes[]) Writes the given bytes (within the specified range) to the given file, with an option for doing it "safely". if (theBytes == null) { aFile.delete(); return; if (!aFile.exists()) { writeBytes(aFile, theBytes); return; File bfile = new File(aFile.getPath() + ".rmbak"); copyFile(aFile, bfile); writeBytes(aFile, theBytes); bfile.delete(); |
File | writeBytesToFile(byte[] bfile, String filePath, String fileName) write Bytes To File BufferedOutputStream bos = null; FileOutputStream fos = null; File file = null; try { file = new File(filePath + "/" + fileName); fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); bos.write(bfile); ... |
void | writeBytesToFile(byte[] byteContent, String fileName) * Output Bytes to file ******************************************. File kekFile = new File("c:\\temp\\" + fileName); FileOutputStream f = new FileOutputStream(kekFile); f.write(byteContent); f.close(); |
void | writeBytesToFile(byte[] bytes, File file) write Bytes To File try { FileOutputStream out = new FileOutputStream(file); out.write(bytes); out.close(); } catch (IOException e) { e.printStackTrace(); |