Skip to content
Snippets Groups Projects
Verified Commit c53fd859 authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

java 10-ify

parent 24334334
No related branches found
No related tags found
No related merge requests found
Pipeline #7472 passed
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" /> <file type="web" url="file://$PROJECT_DIR$" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="10" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -2,14 +2,13 @@ package tester; ...@@ -2,14 +2,13 @@ package tester;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.io.FileNotFoundException; import java.io.*;
import java.io.FileReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
public class Main { public class Main {
public static void main(String[] args) throws FileNotFoundException { public static void main(String[] args) throws FileNotFoundException {
...@@ -92,7 +91,7 @@ public class Main { ...@@ -92,7 +91,7 @@ public class Main {
System.out.printf("File: %s\n", f); System.out.printf("File: %s\n", f);
System.out.println(); System.out.println();
try { try {
String got = Files.readString(Path.of(f)); String got = fileToString(f);
boolean er = compareStrings(got, e); boolean er = compareStrings(got, e);
if (er) { if (er) {
error.set(true); error.set(true);
...@@ -166,4 +165,11 @@ public class Main { ...@@ -166,4 +165,11 @@ public class Main {
} }
return error; return error;
} }
private static String fileToString(String path) throws IOException {
StringBuilder build = new StringBuilder();
Stream<String> stream = Files.lines(Paths.get(path), StandardCharsets.UTF_8);
stream.forEach(s -> build.append(s).append("\n"));
return build.toString();
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment