使用BufferedOutputStream将字节数组写入文件
import java.io.BufferedOutputStream; /* *来 自 时 代 J a v a - N o w J a v a . c o m */ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) { String strFileName = "C:/Folder/Demo"; BufferedOutputStream bos = null; try { FileOutputStream fos = new FileOutputStream(new File(strFileName)); bos = new BufferedOutputStream(fos); /* from nowjava.com*/ String str = "Example"; bos.write(str.getBytes()); } catch (FileNotFoundException fnfe) { System.out.println("Specified file not found" + fnfe); } catch (IOException ioe) { System.out.println("Error while writing file" + ioe); } finally { if (bos != null) { try {