示例1.4 字节流输出
来源:互联网 发布:mac能玩守望先锋吗 编辑:程序博客网 时间:2024/05/01 09:46
package com.mstf.scme.test7;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Foss {
public static void main(String[] args) {
File file=new File("E://999.txt");
FileOutputStream fos=null;
try {
fos=new FileOutputStream(file);
String data="Hello Mstanford";
byte[] byt=data.getBytes();
fos.write(byt);
} catch (FileNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
if (fos!=null) {
try {
fos.close();
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
}
}
}
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Foss {
public static void main(String[] args) {
File file=new File("E://999.txt");
FileOutputStream fos=null;
try {
fos=new FileOutputStream(file);
String data="Hello Mstanford";
byte[] byt=data.getBytes();
fos.write(byt);
} catch (FileNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
if (fos!=null) {
try {
fos.close();
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
}
}
}
0 0
- 示例1.4 字节流输出
- ByteArrayOutputStream(字节数组输出流) 示例
- 字节输出流 OutputStream
- 字节输入/输出流
- 输出字节流
- 输出字节流
- 字节输出流
- 字节输出流
- FileOutputStream字节输出流
- 缓冲输出字节流
- 字节输入 输出流
- 文件字节输出流
- java 输出字节流
- 输入字节流与输出字节流
- java中字节流示例
- java 字节输入流、字节输出流、字节缓冲流
- FileOutPutStream(输出流)字节流
- IO流---字节输出流
- UIAlertController使用的一个坑
- 示例1.3 文件过滤器
- makefie 之赋值
- 即时通信
- linux配置SSH协议免登录密码
- 示例1.4 字节流输出
- 夜间模式 values-night
- Web 服务器错误代码
- http://www.cnblogs.com/technology/p/4467895.html
- 解决重新安装sqlserver2008报错Reporting Services目录数据库文件存在的问题
- 套接字—Socket
- 示例1.5 字符流输出
- Android Camera HAL3中预览preview模式下的控制流
- 示例1.6 文件拷贝