import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class c5 {
public static void main(String[] args) throws IOException {
//创建文件输出流以指定名称写入数据
FileOutputStream fos=new FileOutputStream("D:\\eclipse.jee\\program\\test1\\666.txt");
//FileOutputStream fos=new FileOutputStream("src\\777.txt");
//byte[] bys= {97,98,99,100,101};
byte[] bys="abcde".getBytes(); //getBytes():返回字符串对应的字节数组
fos.write(bys);
//fos.write(bys,1,3); 从指定的索引1处写3个字符
//释放资源
fos.close();
}
}
字节流写输入
最新推荐文章于 2024-10-06 20:16:20 发布