示例1.5 字符流输出

来源:互联网 发布:mac能玩守望先锋吗 编辑:程序博客网 时间:2024/05/01 15:09
package com.mstf.scme.test8;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;


public class Fiss {
public static void main(String[] args) {
File file=new File("E://999.txt");
FileInputStream fis=null;
try {
fis=new FileInputStream(file);
String data="Hello Mstanford";
byte[] byt=data.getBytes();
fis.read(byt);
} catch (FileNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
if (fis!=null) {
try {
fis.close();
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
}
}
}
}
0 0