*关于FileOutputStream:操作文件的字节输出流中有哪些写入数据的方法
* void write(byte[] b) : 写一个字节数组
void write(byte[] b, int off, int len) :写一个字节数组的一部分
public abstract void write(int b) :写入一个字节数据
如果使用字节输出流写数据到指定文件中那么有特定的换行符号
Window:"\r\n"
linux系统:"\n"
mac系统:"\r"
public class FileOutputStreamDemo2 {
public static void main(String[] args) throws IOException {
//1)创建文件字节输出流对象
FileOutputStream fos2=new FileOutputStream("fos2.txt");
//2)
// fos2.write(98);//写入的字节--->底层换算成二进制数据--->使用记事本打开-->对应的ASCII码表
byte[] b= {98,99,100,103};
// void write(byte[] b) : 写一个字节数组
// fos2.write(b);
// void write(byte[] b, int off, int len) :写一个字节数组的一部分
fos2.write(b, 1, 2);
//3)释放资源
fos2.close();
}
}