Java FileOutputStream Create writeFileByBytes(String content, String filename)

Here you can find the source of writeFileByBytes(String content, String filename)

Description

write File By Bytes

License

Apache License

Declaration

public static void writeFileByBytes(String content, String filename) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.OutputStream;

public class Main {
    public static void writeFileByBytes(String content, String filename) throws IOException {
        File file = new java.io.File(filename);
        OutputStream out = null;/*from   w  w w .  j a v a2s.  c o  m*/
        try {
            out = new FileOutputStream(file, true);
            byte[] bytes = content.getBytes();
            out.write(bytes);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (Exception e2) {
                }
            }
        }
    }
}

Related

  1. writeFile0(File file, CharSequence content, Iterable lines)
  2. writeFileAsBytes(String fullPath, byte[] bytes)
  3. writeFileAsString(final File filePath, final String output, final String charset)
  4. writeFileAsString(String filename, String contents)
  5. writeFileBinary(String filename, byte[]... dataArrays)
  6. writeFileByChar(String content, String filename, String encoding)
  7. writeFileByLine(String content, String filename, boolean append)
  8. writeFileBytes(File pFile, byte[] pBytes)
  9. writeFileContent(String filepath, byte[] content)