文件输出字节流(OutputStream)
public class OutputByStream {
public static void main(String[] args) {
try {
FileOutputStream fos = new FileOutputStream("learn3.txt");
String string = new String("我爱高等数学英语Java");
byte b[] = string.getBytes("UTF-8");
fos.write(b);
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
本文标题:文件输出字节流(OutputStream)
本文链接:https://www.haomeiwen.com/subject/nvkdjftx.html
网友评论