아래 코드를 사용하여 .properties 파일에 속성을 쓰고 있습니다. 이 정렬 된 위치에 있지만 내가 그것을 얻을 수 괜찮나 항상 at the end
추가됩니다 원하는 나누었다 마지막에 속성을 추가하고 있지만하나의 .properties 파일 끝에 끝에 속성을 추가하는 방법
InputStream inputStream = null;
try {
inputStream = file.getContents();
Properties properties = new Properties();
properties.load(inputStream);
inputStream.close();
properties.setProperty(propertyKey.trim(), propertyValue.trim());
File file1 = file.getRawLocation().makeAbsolute().toFile();
FileOutputStream outputStream = new FileOutputStream(file1);
properties.store(outputStream, null);
outputStream.close();
}
} catch (IOException ex) {
ex.printStackTrace();
} catch (CoreException ex) {
ex.printStackTrace();
}
?
'IFile'을 사용하고있는 것처럼 보입니다. 파일을 저장하기 위해'IFile.setContents'를 사용해야합니다. 현재의 메소드는 Eclipse와의 동기화를 벗어난 파일을 남겨 둡니다. –
예, u r right.it는 eclipse와 동기화되지 않은 파일을 표시하고 있습니다. – Anu