File tree Expand file tree Collapse file tree
core-java-io-conversions-2
main/java/com/baeldung/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,4 +6,6 @@ This module contains articles about core Java input/output(IO) conversions.
66- [ Java InputStream to String] ( https://www.baeldung.com/convert-input-stream-to-string )
77- [ Java – Write an InputStream to a File] ( https://www.baeldung.com/convert-input-stream-to-a-file )
88- [ Converting a BufferedReader to a JSONObject] ( https://www.baeldung.com/java-bufferedreader-to-jsonobject )
9+ - [ Reading a CSV File into an Array] ( https://www.baeldung.com/java-csv-file-array )
10+ - [ How to Write to a CSV File in Java] ( https://www.baeldung.com/java-csv )
911- More articles: [[ <-- prev]] ( /core-java-modules/core-java-io-conversions )
Original file line number Diff line number Diff line change 2626 <artifactId >json</artifactId >
2727 <version >${json.version} </version >
2828 </dependency >
29+ <dependency >
30+ <groupId >com.opencsv</groupId >
31+ <artifactId >opencsv</artifactId >
32+ <version >${opencsv.version} </version >
33+ <scope >test</scope >
34+ </dependency >
2935 </dependencies >
3036
3137 <build >
4046
4147 <properties >
4248 <json .version>20200518</json .version>
49+ <opencsv .version>4.1</opencsv .version>
4350 </properties >
4451
4552</project >
File renamed without changes.
Original file line number Diff line number Diff line change 11package com .baeldung .csv ;
22
3- import java .io .BufferedReader ;
4- import java .io .File ;
5- import java .io .FileNotFoundException ;
6- import java .io .FileReader ;
7- import java .io .IOException ;
8- import java .util .ArrayList ;
9- import java .util .Arrays ;
10- import java .util .Collections ;
11- import java .util .List ;
12- import java .util .Scanner ;
13-
3+ import com .opencsv .CSVReader ;
144import org .junit .Assert ;
155import org .junit .Test ;
166
17- import com .opencsv .CSVReader ;
7+ import java .io .*;
8+ import java .util .*;
189
1910public class ReadCSVInArrayUnitTest {
2011 public static final String COMMA_DELIMITER = "," ;
Original file line number Diff line number Diff line change 11package com .baeldung .csv ;
22
3- import static org .junit .Assert .assertEquals ;
4- import static org .junit .Assert .assertTrue ;
3+ import org .junit .Before ;
4+ import org .junit .Test ;
5+ import org .slf4j .Logger ;
6+ import org .slf4j .LoggerFactory ;
57
68import java .io .File ;
79import java .io .FileNotFoundException ;
1012import java .util .ArrayList ;
1113import java .util .List ;
1214
13- import org .junit .Before ;
14- import org .junit .Test ;
15- import org .slf4j .Logger ;
16- import org .slf4j .LoggerFactory ;
15+ import static org .junit .Assert .assertEquals ;
16+ import static org .junit .Assert .assertTrue ;
1717
1818public class WriteCsvFileExampleUnitTest {
1919 private static final Logger LOG = LoggerFactory .getLogger (WriteCsvFileExampleUnitTest .class );
File renamed without changes.
Original file line number Diff line number Diff line change @@ -8,10 +8,8 @@ This module contains articles about core Java input and output (IO)
88- [ Java – Directory Size] ( https://www.baeldung.com/java-folder-size )
99- [ File Size in Java] ( https://www.baeldung.com/java-file-size )
1010- [ Zipping and Unzipping in Java] ( https://www.baeldung.com/java-compress-and-uncompress )
11- - [ Reading a CSV File into an Array] ( https://www.baeldung.com/java-csv-file-array )
1211- [ How to Get the File Extension of a File in Java] ( https://www.baeldung.com/java-file-extension )
1312- [ Getting a File’s Mime Type in Java] ( https://www.baeldung.com/java-file-mime-type )
14- - [ How to Write to a CSV File in Java] ( https://www.baeldung.com/java-csv )
1513- [ How to Avoid the Java FileNotFoundException When Loading Resources] ( https://www.baeldung.com/java-classpath-resource-cannot-be-opened )
1614- [ Create a Directory in Java] ( https://www.baeldung.com/java-create-directory )
1715- [[ More -->]] ( /core-java-modules/core-java-io-2 )
Original file line number Diff line number Diff line change 2929 <version >${hsqldb.version} </version >
3030 <scope >runtime</scope >
3131 </dependency >
32- <dependency >
33- <groupId >com.opencsv</groupId >
34- <artifactId >opencsv</artifactId >
35- <version >${opencsv.version} </version >
36- <scope >test</scope >
37- </dependency >
3832 <!-- Mime Type Resolution Libraries -->
3933 <dependency >
4034 <groupId >org.apache.tika</groupId >
142136 </profiles >
143137
144138 <properties >
145- <!-- util -->
146- <opencsv .version>4.1</opencsv .version>
147139 <!-- testing -->
148140 <assertj .version>3.6.1</assertj .version>
149141 <!-- maven plugins -->
You can’t perform that action at this time.
0 commit comments