mirror of
https://github.com/RatzzFatzz/MKVAudioSubtitleChanger.git
synced 2026-02-11 02:05:56 +01:00
Add version parameter
This commit is contained in:
@@ -3,11 +3,8 @@ package at.pcgamingfreaks.mkvaudiosubtitlechanger.util;
|
||||
import at.pcgamingfreaks.mkvaudiosubtitlechanger.config.ConfigErrors;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -17,18 +14,14 @@ public class LanguageValidatorUtil {
|
||||
|
||||
static {
|
||||
try {
|
||||
ISO3_LANGUAGES = load("language-codes");
|
||||
ISO3_LANGUAGES = loadLanguageCodes();
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
private static Set<String> load(String path) throws IOException{
|
||||
if (new File(path).isFile()) {
|
||||
return Files.lines(Path.of(path)).collect(Collectors.toSet());
|
||||
} else {
|
||||
try(BufferedReader bf = new BufferedReader(new InputStreamReader(
|
||||
Objects.requireNonNull(LanguageValidatorUtil.class.getClassLoader().getResourceAsStream(path))))) {
|
||||
return bf.lines().collect(Collectors.toSet());
|
||||
}
|
||||
private static Set<String> loadLanguageCodes() throws IOException {
|
||||
try (BufferedReader bf = new BufferedReader(new InputStreamReader(
|
||||
Objects.requireNonNull(LanguageValidatorUtil.class.getClassLoader().getResourceAsStream("language-codes"))))) {
|
||||
return bf.lines().collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user