import java.util.*;
import java.io.*;
class ExProperties {
public static void main(String args[]) {
ExProperties ini = new ExProperties();
ini.doit();
}
public void doit() {
try{
Properties p = new Properties();
// ini 파일 읽기
p.load(new FileInputStream("user.ini"));
// Key 값 읽기
System.out.println("user = " + p.getProperty("DBuser"));
System.out.println("password = " + p.getProperty("DBpassword"));
System.out.println("location = " + p.getProperty("DBlocation"));
// Key 값 저장
p.setProperty("Key", p.getProperty("DBuser" ));
p.list(System.out);
// ini 파일 쓰기
p.store( new FileOutputStream("user.ini"), "done.");
}
catch (Exception e) {
System.out.println(e);
}
}
}
http://pyoungon.tistory.com/22
'◆ 무한한 가능성 > & JAVA' 카테고리의 다른 글
Excel Export in Spring MVC. 자바 스프링에서 엑셀저장 엑셀다운로드 (0) | 2016.05.15 |
---|---|
자바(JAVA) 형 변환(String to Date, Date to String) (0) | 2016.03.21 |
JAVA - 한글 인코딩 변환 체크 한방에 끝내기 (0) | 2016.03.13 |
RESTful (0) | 2015.05.19 |
[Spring] MAVEN 없이 Spring Framework 다운로드 받기 (0) | 2015.03.21 |