properties 프로필 정 보 를 Properties 대상 으로 읽 기

886 단어 Java
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.Properties;
import java.util.Set;

public class   2 {
    /*
     *         :     :         :   ,   ,   ,             ,    Properties   
     */

    public static void main(String[] args) throws Exception {
        InputStreamReader fos = new InputStreamReader(new FileInputStream("s.properties"), "utf-8");
        Properties p = new Properties();
        p.load(fos);
        Set stringPropertyNames = p.stringPropertyNames();
        for (String string : stringPropertyNames) {
            System.out.println(string + "---" + p.get(string));
        }
        fos.close();

    }

}

좋은 웹페이지 즐겨찾기