Compare commits
No commits in common. "492e461307a44790d3df8369fd0d748cb0b51c8f" and "bb8713049bb2e62e2e5126ce0c8d01a1374a7b3e" have entirely different histories.
492e461307
...
bb8713049b
3
pom.xml
3
pom.xml
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -25,10 +25,6 @@ import java.nio.charset.StandardCharsets;
|
|||
public class FileOperations {
|
||||
|
||||
public static boolean writeTextToFile(String filePath, String text) {
|
||||
return writeBytesToFile(filePath, text.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public static boolean writeBytesToFile(String filePath, byte[] bytes) {
|
||||
File file = new File(filePath);
|
||||
if (!file.canWrite()) {
|
||||
return false;
|
||||
|
|
@ -36,12 +32,11 @@ public class FileOperations {
|
|||
|
||||
try {
|
||||
FileOutputStream fileStream = new FileOutputStream(file);
|
||||
fileStream.write(bytes);
|
||||
return true;
|
||||
fileStream.write(text.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (FileNotFoundException ex) {
|
||||
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue