Skip to content

Commit

Permalink
Fixed issue with reading from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Duckelekuuk committed Dec 1, 2022
1 parent 71af095 commit c637289
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/duckelekuuk/aoc/utils/InputFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
Expand Down Expand Up @@ -51,11 +52,11 @@ public static String getInput(Path cachePath, boolean autoFetch, String session,
}

private static void cacheInput(Path cachePath, int day, String input) throws IOException {
Files.writeString(cachePath.resolve(String.format(CACHE_FILE, day)), input);
Files.writeString(cachePath.resolve(String.format(CACHE_FILE, day)), input, StandardCharsets.UTF_8);
}

private static String getFromCache(Path cachePath, int day) throws IOException {
return Files.readString(cachePath.resolve(String.format(CACHE_FILE, day)));
return Files.readString(cachePath.resolve(String.format(CACHE_FILE, day)), StandardCharsets.UTF_8);
}

private static boolean isCached(Path cachePath, int day) {
Expand Down

0 comments on commit c637289

Please sign in to comment.