其他分享
首页 > 其他分享> > IO流标准输入输出流

IO流标准输入输出流

作者:互联网

标准输入输出流

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);
}
}

标签:java,String,io,输入输出,标准,IO,new,import,properties
来源: https://www.cnblogs.com/jinnice/p/16684580.html