Here you can find the source of writeBytes(File file, byte[] bytes)
public static void writeBytes(File file, byte[] bytes) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { private final static String UTF8 = "UTF-8"; public static void writeBytes(File file, byte[] bytes) throws IOException { FileOutputStream out = new FileOutputStream(file); out.write(bytes);/*from w ww . j ava 2 s. co m*/ out.close(); } public static void write(File file, String content) throws IOException { writeBytes(file, utf8(content)); } public static byte[] utf8(String string) { try { return string.getBytes(UTF8); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } } public static String utf8(byte[] bytes) { try { return new String(bytes, UTF8); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } } }