szetszwo commented on code in PR #8015:
URL: https://github.com/apache/ozone/pull/8015#discussion_r1983208835
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/IOUtils.java:
##########
@@ -95,4 +104,20 @@ public static void closeQuietly(AutoCloseable...
closeables) {
public static void closeQuietly(Collection<? extends AutoCloseable>
closeables) {
close(null, closeables);
}
+
+ /** Write {@code properties} to the file at {@code path}, truncating any
existing content. */
+ public static void writePropertiesToFile(Path path, Properties properties)
throws IOException {
+ StringWriter out = new StringWriter();
+ properties.store(out, null);
+ Files.write(path, out.toString().getBytes(UTF_8));
Review Comment:
The previous implementation with [store(OutputStream,
String)](https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.InputStream-)
was using ISO 8859-1 instead of UTF8. How about keeping it?
```java
try (OutputStream out = Files.newOutputStream(path, CREATE,
TRUNCATE_EXISTING, WRITE)) {
properties.store(out, null);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]