Java Utililty Methods FileOutputStream Write

List of utility methods to do FileOutputStream Write

Description

The list of methods to do FileOutputStream Write are organized into topic(s).

Method

voidsave(String f, byte[] data)
Save the given byte array as the given file.
save(new File(f), data);
voidsave(String filename, byte[] bytes)
save
ByteArrayInputStream bais = null;
try {
    bais = new ByteArrayInputStream(bytes);
    save(filename, bais);
    bais.close();
    bais = null;
} catch (IOException ex) {
    throw new RuntimeException(ex);
...
voidsave(String path, byte[] content, IProgressMonitor monitor)
Saves a file.
monitor.beginTask("Saving " + path, 1);
FileOutputStream out = new FileOutputStream(path);
out.write(content);
out.flush();
out.close();
voidsaveArray(byte[] pictureBytes, OutputStream stream)
save Array
try {
    stream.write(pictureBytes);
} catch (IOException e) {
voidsaveBase64Str2Disk(String base64Str, File file)
save Base Str Disk
BASE64Decoder decoder = new BASE64Decoder();
FileOutputStream write = new FileOutputStream(file);
byte[] decoderBytes = decoder.decodeBuffer(base64Str);
write.write(decoderBytes);
write.close();
voidsaveBase64strToFile(String base64Str, String filePath)
save Basestr To File
BASE64Decoder decoder = new BASE64Decoder();
byte[] b = decoder.decodeBuffer(base64Str);
for (int i = 0; i < b.length; ++i) {
    if (b[i] < 0) {
        b[i] += 256;
OutputStream out = new FileOutputStream(filePath);
...
voidsaveBinaryFile(String fileName, byte[] buffer)
save Binary File
FileOutputStream fstream = new FileOutputStream(fileName);
fstream.write(buffer);
fstream.close();
voidsaveByteArrayToFile(final File file, final byte[] array)
save Byte Array To File
FileOutputStream outStream = null;
try {
    outStream = new FileOutputStream(file);
    outStream.write(array);
    outStream.flush();
} finally {
    if (outStream != null) {
        try {
...
voidsaveByteFile(byte[] data, String filePath)
save Byte File
saveByteFile(data, new File(filePath));
voidsaveBytes(byte[] b, File destFolder, String fileName, String suffix)
Saves raw byte data to the chosen output folder, but uses the given file filename + the given suffix
OutputStream out = null;
try {
    File f = new File(
            destFolder.getAbsolutePath() + "/" + fileName.substring(0, fileName.lastIndexOf(".")) + suffix);
    if (f.exists())
        f.delete();
    out = new FileOutputStream(f);
    out.write(b);
...