日期:2014-05-20 浏览次数:20844 次
byte[] bytes = "fsadf".getBytes();//byte数组
try {
OutputStream os = new FileOutputStream(new File("输出文件路径"));
BufferedInputStream is = new BufferedInputStream(new ByteArrayInputStream(bytes));
byte[] buf = new byte[1024];
int len;
while ((len = is.read(buf)) != -1) {
os.write(buf, 0, len);
os.flush();
}
is.close();
os.close();
} catch (IOException ex) {
ex.printStackTrace(System.err);
}