diff --git a/core-java-modules/core-java-io-conversions-2/README.md b/core-java-modules/core-java-io-conversions-2/README.md index 9ce36e7437..b2153b3669 100644 --- a/core-java-modules/core-java-io-conversions-2/README.md +++ b/core-java-modules/core-java-io-conversions-2/README.md @@ -6,4 +6,6 @@ This module contains articles about core Java input/output(IO) conversions. - [Java InputStream to String](https://www.baeldung.com/convert-input-stream-to-string) - [Java – Write an InputStream to a File](https://www.baeldung.com/convert-input-stream-to-a-file) - [Converting a BufferedReader to a JSONObject](https://www.baeldung.com/java-bufferedreader-to-jsonobject) +- [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) +- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv) - More articles: [[<-- prev]](/core-java-modules/core-java-io-conversions) diff --git a/core-java-modules/core-java-io-conversions-2/pom.xml b/core-java-modules/core-java-io-conversions-2/pom.xml index e9cf3f55d1..b8b5074c7c 100644 --- a/core-java-modules/core-java-io-conversions-2/pom.xml +++ b/core-java-modules/core-java-io-conversions-2/pom.xml @@ -26,6 +26,12 @@ json ${json.version} + + com.opencsv + opencsv + ${opencsv.version} + test + @@ -40,6 +46,7 @@ 20200518 + 4.1 \ No newline at end of file diff --git a/core-java-modules/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-modules/core-java-io-conversions-2/src/main/java/com/baeldung/csv/WriteCsvFileExample.java similarity index 100% rename from core-java-modules/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java rename to core-java-modules/core-java-io-conversions-2/src/main/java/com/baeldung/csv/WriteCsvFileExample.java diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java similarity index 92% rename from core-java-modules/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java rename to core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java index 2593eee82b..7e4c1a127f 100644 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java +++ b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java @@ -1,20 +1,11 @@ package com.baeldung.csv; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Scanner; - +import com.opencsv.CSVReader; import org.junit.Assert; import org.junit.Test; -import com.opencsv.CSVReader; +import java.io.*; +import java.util.*; public class ReadCSVInArrayUnitTest { public static final String COMMA_DELIMITER = ","; diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java similarity index 100% rename from core-java-modules/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java rename to core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java index 5f4827bc21..fa76472685 100644 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java +++ b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -1,7 +1,9 @@ package com.baeldung.csv; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileNotFoundException; @@ -10,10 +12,8 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class WriteCsvFileExampleUnitTest { private static final Logger LOG = LoggerFactory.getLogger(WriteCsvFileExampleUnitTest.class); diff --git a/core-java-modules/core-java-io/src/test/resources/book.csv b/core-java-modules/core-java-io-conversions-2/src/test/resources/book.csv similarity index 100% rename from core-java-modules/core-java-io/src/test/resources/book.csv rename to core-java-modules/core-java-io-conversions-2/src/test/resources/book.csv diff --git a/core-java-modules/core-java-io/README.md b/core-java-modules/core-java-io/README.md index 2c6c3363cb..dd0f4f58c3 100644 --- a/core-java-modules/core-java-io/README.md +++ b/core-java-modules/core-java-io/README.md @@ -8,10 +8,8 @@ This module contains articles about core Java input and output (IO) - [Java – Directory Size](https://www.baeldung.com/java-folder-size) - [File Size in Java](https://www.baeldung.com/java-file-size) - [Zipping and Unzipping in Java](https://www.baeldung.com/java-compress-and-uncompress) -- [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) - [How to Get the File Extension of a File in Java](https://www.baeldung.com/java-file-extension) - [Getting a File’s Mime Type in Java](https://www.baeldung.com/java-file-mime-type) -- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv) - [How to Avoid the Java FileNotFoundException When Loading Resources](https://www.baeldung.com/java-classpath-resource-cannot-be-opened) - [Create a Directory in Java](https://www.baeldung.com/java-create-directory) - [[More -->]](/core-java-modules/core-java-io-2) diff --git a/core-java-modules/core-java-io/pom.xml b/core-java-modules/core-java-io/pom.xml index ccfb57e909..0968536e65 100644 --- a/core-java-modules/core-java-io/pom.xml +++ b/core-java-modules/core-java-io/pom.xml @@ -29,12 +29,6 @@ ${hsqldb.version} runtime - - com.opencsv - opencsv - ${opencsv.version} - test - org.apache.tika @@ -142,8 +136,6 @@ - - 4.1 3.6.1