728x90
반응형
Properties 클래스
특징
- Properties 클래스는 HashaTabkes 클래스를 상속받았다. Properties 클래스는 Key와 Value를 갖는다.
- Properties 클래스는 파일 입출력을 지원한다.
- key=value 형식으로 작성 된 파일을 key와 value로 나누어 저장, 출력할 때 유용하다.
메서드 종류
1. void load(FileInputStream file) / load(FileReader file) : 스트림으로 열린 Properties 파일 객체를 로드함
2. String getProperty(String key) : key값을 제공하면 해당하는 value를 문자열로 변환함
3. Object setProperty(String key, value) : Properties 객체에 키와 값 저장
4. void store(스트림객체, 주석) : 객체에 저장된 내용을 파일에 씀(OutPutStream, Writer 계열만 가능)
FileInputStream fis = new FileInputStream();
Properties pp = new Properties();
fis = FileInputStream(
DTO.getConfig_path() + File.separator + "conf" + File.separator + "config.properties");
pp.load(fis);
DTO.setSKTL_business_time(pp.getProperty("SKTL_business_time"));
pp.setProperty("last_per_update", DTO.getLast_per_update());
pp.store(new FileOutputStream(
DTO.getConfig_path() + File.separator + "conf" + File.separator + "config.properties"), "");
728x90
반응형
'IT > WEB' 카테고리의 다른 글
[JS] 제이쿼리 선택자에 변수 넣기 (0) | 2021.10.14 |
---|---|
[JAVA] 스케줄러(Quartz) 실행하는 법 (0) | 2021.10.13 |
[JAVA] 파일 복호화(aes256)_참고용 (0) | 2021.04.16 |
[JAVA] 파일 암호화(aes256)_참고용 (0) | 2021.04.16 |
[JAVA] 암호화 알고리즘 AES-256(with base64) 암호화 복호화 사용 (0) | 2021.04.08 |