标准输入输出流
system.in的编译类型是inputstream
运行类型是bufferedinputstream
system.out的编译类型和运行类型都是printstream
转换流
该流可以将字节流转换成字符流,并且指定相应的编码类型;
package com.wang.inputandoutstream;
import java.io.*;
public class intout {
public static void main(String[] args) throws IOException {
String path="d:/name.txt";
InputStreamReader inputStreamReader= new InputStreamReader(new FileInputStream(path));
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String line;
line=bufferedReader.readLine();
System.out.println(line);
bufferedReader.close();
}
}
Propertise类
可以用来操作配置文件信息
package com;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
public class porpertise {
public static void main(String[] args) throws IOException {
Properties properties = new Properties();
properties.load(new FileReader(“src/mysql.propertise.properties”));
properties.list(System.out);
String id=properties.getProperty(“id”);
System.out.println(id);
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/288839.html