diff --git a/pom.xml b/pom.xml
index 48f68ca..8c5ddc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
xyz.socttc
VocabularyDecoder
- 0.0.5
+ 0.0.7
@@ -15,20 +15,6 @@
20200518
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 3.3.0
-
-
@@ -69,6 +55,7 @@
xyz.scottc.vd.Main
+ UTF-8
@@ -77,26 +64,14 @@
single
+
+ UTF-8
+
-
-
- src/main/java
-
- **/*.*
-
-
-
- src/main/resources
-
- **/*.*
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/xyz/scottc/vd/Main.java b/src/main/java/xyz/scottc/vd/Main.java
index d5730a5..72311a3 100644
--- a/src/main/java/xyz/scottc/vd/Main.java
+++ b/src/main/java/xyz/scottc/vd/Main.java
@@ -9,6 +9,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLDecoder;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -85,7 +86,7 @@ private static void initDirectory() {
private static void initInternalLibraryInJar() throws IOException {
String sourceDir = "internalLibrary/";
- String jarPath = FileUtils.getJarFilePath(Main.class);
+ String jarPath = URLDecoder.decode(FileUtils.getJarFilePath(Main.class), "UTF-8");
JarFile jarFile = new JarFile(jarPath);
Enumeration entries = jarFile.entries();
while (entries.hasMoreElements()) {
@@ -95,7 +96,7 @@ private static void initInternalLibraryInJar() throws IOException {
InputStream inputStream = Main.class.getResourceAsStream("/" + filePath);
String fileName = filePath.substring(sourceDir.length());
File targetFile = new File(internalLibrary.getAbsolutePath() + "/" + fileName);
- if (!targetFile.isDirectory()) {
+ if (fileName.contains(".")) {
//ignore whether the file exists, add it to the list if it is a regular file
if (!targetFile.exists()) {
Files.copy(inputStream, targetFile.toPath());
diff --git a/src/main/java/xyz/scottc/vd/utils/FileUtils.java b/src/main/java/xyz/scottc/vd/utils/FileUtils.java
index 9260f7a..36d8217 100644
--- a/src/main/java/xyz/scottc/vd/utils/FileUtils.java
+++ b/src/main/java/xyz/scottc/vd/utils/FileUtils.java
@@ -5,6 +5,7 @@
import javax.swing.*;
import java.io.*;
import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
public class FileUtils {
@@ -32,6 +33,7 @@ public static byte[] readFromInputStream(InputStream inputStream) throws IOExcep
public static String getJarFilePath(Class> object) {
if (object != null) {
+
return object.getProtectionDomain().getCodeSource().getLocation().getPath();
}
return null;
@@ -92,6 +94,22 @@ public static void copyFile(InputStream inputStream, File targetDir, String file
}
}
+ public static void copyTextFile(InputStream inputStream, File target) {
+ try {
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
+ new FileOutputStream(target)
+ ));
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = inputStream.read(buffer)) != -1) {
+ writer.write(new String(buffer, 0, length, StandardCharsets.UTF_8));
+ }
+ writer.flush();
+ } catch (IOException exception) {
+ exception.printStackTrace();
+ }
+ }
+
public static void closeStream(InputStream inputStream, OutputStream outputStream) {
if (inputStream != null) {
try {
diff --git a/src/main/resources/internalLibrary/SAT/SAT3000/Level2List02.txt.vd b/src/main/resources/internalLibrary/SAT/SAT3000/Level2List02.txt.vd
index 659b6db..259c03e 100644
--- a/src/main/resources/internalLibrary/SAT/SAT3000/Level2List02.txt.vd
+++ b/src/main/resources/internalLibrary/SAT/SAT3000/Level2List02.txt.vd
@@ -147,7 +147,7 @@
"utter",
"outrage",
"betray",
- "affilate",
+ "affiliate",
"batter",
"irritate",
"oversee",
@@ -187,7 +187,7 @@
"brutal",
"precedent",
"memoir",
- "comtempt",
+ "contempt",
"mighty",
"glorious",
"heir",