private static void readFileStream() {
try {
InputStream is = new FileInputStream("src/article.txt");
byte[] buf = new byte[1024];
int len = 0;
while((len=is.read(buf))>0){
System.out.println(new String(buf, 0, len));
}
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private static void writeFileStream() {
try {
OutputStream os = new FileOutputStream("src/myarticle.txt");
String str = "写....";
byte[] b = str.getBytes("utf-8");
os.write(b);
os.flush();
os.close();
} catch (Exception e) {
e.printStackTrace();
}
}