プロパティ ファイルに 16 進数の値を追加しようとしています。値は保存されていますが、"\"が追加されているのがわかります。これは望ましくありません。
test.properties
#
#Fri Jun 07 21:18:49 GMT+05:30 2013
test=fe\:fe
Java ファイル
public class PropertySave {
private static File s_file;
private static Properties s_properties = new Properties();
public static void main(String[] args) {
loadProperties();
s_properties.setProperty("test", "fe:fe");
saveProperties();
}
private static void saveProperties() {
FileOutputStream fout = null;
try {
fout = new FileOutputStream(s_file);
s_properties.store(fout, "");
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(1);
} finally {
if (fout != null) {
try {
fout.close();
} catch (final IOException ioe2) {
ioe2.printStackTrace();
System.exit(1);
}
}
}
}
private static void loadProperties() {
s_file = new File("test.properties");
if ((!s_file.exists()) || (!s_file.isFile())) {
System.exit(1);
}
FileInputStream fin = null;
try {
fin = new FileInputStream(s_file);
s_properties.load(fin);
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(1);
} finally {
if (fin != null) {
try {
fin.close();
} catch (final IOException ioe2) {
ioe2.printStackTrace();
System.exit(1);
}
}
}
}
}
Java ファイルでは、s_properties.setProperty("test", "fe:fe"); プロパティ ファイルの出力が異なります (test.properties) fe:feこのプロパティ ファイルは"C"言語で他のシステムに入力されるため、これは無視します。
Javaファイルの入力とプロパティファイルの出力が同じになるようにするにはどうすればよいですか