Merge pull request #8149 from catalin-burcea/BAEL-15998
[BAEL-15998] - Move articles out of core-java-io part 1
This commit is contained in:
commit
39f5913c7d
|
@ -5,6 +5,5 @@ This module contains modules about core Java
|
|||
## Relevant articles:
|
||||
|
||||
- [Multi-Module Maven Application with Java Modules](https://www.baeldung.com/maven-multi-module-project-java-jpms)
|
||||
- [Guide to Java FileChannel](https://www.baeldung.com/java-filechannel)
|
||||
- [Understanding the NumberFormatException in Java](https://www.baeldung.com/java-number-format-exception)
|
||||
- [Will an Error Be Caught by Catch Block in Java?](https://www.baeldung.com/java-error-catch)
|
||||
|
|
|
@ -13,22 +13,11 @@ This module contains articles about core Java input and output (IO)
|
|||
- [Differences Between the Java WatchService API and the Apache Commons IO Monitor Library](http://www.baeldung.com/java-watchservice-vs-apache-commons-io-monitor-library)
|
||||
- [File Size in Java](http://www.baeldung.com/java-file-size)
|
||||
- [Comparing getPath(), getAbsolutePath(), and getCanonicalPath() in Java](http://www.baeldung.com/java-path)
|
||||
- [Using Java MappedByteBuffer](http://www.baeldung.com/java-mapped-byte-buffer)
|
||||
- [How to Copy a File with Java](http://www.baeldung.com/java-copy-file)
|
||||
- [Java – Append Data to a File](http://www.baeldung.com/java-append-to-file)
|
||||
- [FileNotFoundException in Java](http://www.baeldung.com/java-filenotfound-exception)
|
||||
- [How to Read a File in Java](http://www.baeldung.com/reading-file-in-java)
|
||||
- [A Guide To NIO2 Asynchronous File Channel](http://www.baeldung.com/java-nio2-async-file-channel)
|
||||
- [A Guide To NIO2 FileVisitor](http://www.baeldung.com/java-nio2-file-visitor)
|
||||
- [A Guide To NIO2 File Attribute APIs](http://www.baeldung.com/java-nio2-file-attribute)
|
||||
- [Introduction to the Java NIO2 File API](http://www.baeldung.com/java-nio-2-file-api)
|
||||
- [Zipping and Unzipping in Java](http://www.baeldung.com/java-compress-and-uncompress)
|
||||
- [Java NIO2 Path API](http://www.baeldung.com/java-nio-2-path)
|
||||
- [A Guide to WatchService in Java NIO2](http://www.baeldung.com/java-nio2-watchservice)
|
||||
- [Guide to Java NIO2 Asynchronous Channel APIs](http://www.baeldung.com/java-nio-2-async-channels)
|
||||
- [A Guide to NIO2 Asynchronous Socket Channel](http://www.baeldung.com/java-nio2-async-socket-channel)
|
||||
- [Download a File From an URL in Java](http://www.baeldung.com/java-download-file)
|
||||
- [Create a Symbolic Link with Java](http://www.baeldung.com/java-symlink)
|
||||
- [Quick Use of FilenameFilter](http://www.baeldung.com/java-filename-filter)
|
||||
- [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist)
|
||||
- [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream)
|
||||
|
@ -40,6 +29,5 @@ This module contains articles about core Java input and output (IO)
|
|||
- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv)
|
||||
- [List Files in a Directory in Java](https://www.baeldung.com/java-list-directory-files)
|
||||
- [Java InputStream to Byte Array and ByteBuffer](https://www.baeldung.com/convert-input-stream-to-array-of-bytes)
|
||||
- [Introduction to the Java NIO Selector](https://www.baeldung.com/java-nio-selector)
|
||||
- [How to Avoid the Java FileNotFoundException When Loading Resources](https://www.baeldung.com/java-classpath-resource-cannot-be-opened)
|
||||
- [[More -->]](/core-java-modules/core-java-io-2)
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
<version>${hsqldb.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.asynchttpclient/async-http-client -->
|
||||
<dependency>
|
||||
<groupId>org.asynchttpclient</groupId>
|
||||
<artifactId>async-http-client</artifactId>
|
||||
<version>${async-http-client.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
|
@ -155,7 +149,6 @@
|
|||
<!-- maven plugins -->
|
||||
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
|
||||
<hsqldb.version>2.4.0</hsqldb.version>
|
||||
<async-http-client.version>2.4.5</async-http-client.version>
|
||||
<!-- Mime Type Libraries -->
|
||||
<tika.version>1.18</tika.version>
|
||||
<jmime-magic.version>0.1.5</jmime-magic.version>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
###Relevant Articles:
|
||||
- [Introduction to the Java NIO Selector](http://www.baeldung.com/java-nio-selector)
|
|
@ -1,165 +0,0 @@
|
|||
package com.baeldung.filechannel;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.FileLock;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class FileChannelUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenFile_whenReadWithFileChannelUsingRandomAccessFile_thenCorrect() throws IOException {
|
||||
|
||||
try (RandomAccessFile reader = new RandomAccessFile("src/test/resources/test_read.in", "r");
|
||||
FileChannel channel = reader.getChannel();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();) {
|
||||
|
||||
int bufferSize = 1024;
|
||||
if (bufferSize > channel.size()) {
|
||||
bufferSize = (int) channel.size();
|
||||
}
|
||||
ByteBuffer buff = ByteBuffer.allocate(bufferSize);
|
||||
|
||||
while (channel.read(buff) > 0) {
|
||||
out.write(buff.array(), 0, buff.position());
|
||||
buff.clear();
|
||||
}
|
||||
|
||||
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
|
||||
|
||||
assertEquals("Hello world", fileContent);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFile_whenReadWithFileChannelUsingFileInputStream_thenCorrect() throws IOException {
|
||||
|
||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
FileInputStream fin = new FileInputStream("src/test/resources/test_read.in");
|
||||
FileChannel channel = fin.getChannel();) {
|
||||
|
||||
int bufferSize = 1024;
|
||||
if (bufferSize > channel.size()) {
|
||||
bufferSize = (int) channel.size();
|
||||
}
|
||||
ByteBuffer buff = ByteBuffer.allocate(bufferSize);
|
||||
|
||||
while (channel.read(buff) > 0) {
|
||||
out.write(buff.array(), 0, buff.position());
|
||||
buff.clear();
|
||||
}
|
||||
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8);
|
||||
|
||||
assertEquals("Hello world", fileContent);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFile_whenReadAFileSectionIntoMemoryWithFileChannel_thenCorrect() throws IOException {
|
||||
|
||||
try (RandomAccessFile reader = new RandomAccessFile("src/test/resources/test_read.in", "r");
|
||||
FileChannel channel = reader.getChannel();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();) {
|
||||
|
||||
MappedByteBuffer buff = channel.map(FileChannel.MapMode.READ_ONLY, 6, 5);
|
||||
|
||||
if (buff.hasRemaining()) {
|
||||
byte[] data = new byte[buff.remaining()];
|
||||
buff.get(data);
|
||||
assertEquals("world", new String(data, StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenWriteWithFileChannelUsingRandomAccessFile_thenCorrect() throws IOException {
|
||||
String file = "src/test/resources/test_write_using_filechannel.txt";
|
||||
try (RandomAccessFile writer = new RandomAccessFile(file, "rw");
|
||||
FileChannel channel = writer.getChannel();) {
|
||||
ByteBuffer buff = ByteBuffer.wrap("Hello world".getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
channel.write(buff);
|
||||
|
||||
// now we verify whether the file was written correctly
|
||||
RandomAccessFile reader = new RandomAccessFile(file, "r");
|
||||
assertEquals("Hello world", reader.readLine());
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFile_whenWriteAFileUsingLockAFileSectionWithFileChannel_thenCorrect() throws IOException {
|
||||
try (RandomAccessFile reader = new RandomAccessFile("src/test/resources/test_read.in", "rw");
|
||||
FileChannel channel = reader.getChannel();
|
||||
FileLock fileLock = channel.tryLock(6, 5, Boolean.FALSE);) {
|
||||
|
||||
assertNotNull(fileLock);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFile_whenReadWithFileChannelGetPosition_thenCorrect() throws IOException {
|
||||
|
||||
try (ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
RandomAccessFile reader = new RandomAccessFile("src/test/resources/test_read.in", "r");
|
||||
FileChannel channel = reader.getChannel();) {
|
||||
|
||||
int bufferSize = 1024;
|
||||
if (bufferSize > channel.size()) {
|
||||
bufferSize = (int) channel.size();
|
||||
}
|
||||
ByteBuffer buff = ByteBuffer.allocate(bufferSize);
|
||||
|
||||
while (channel.read(buff) > 0) {
|
||||
out.write(buff.array(), 0, buff.position());
|
||||
buff.clear();
|
||||
}
|
||||
|
||||
// the original file is 11 bytes long, so that's where the position pointer should be
|
||||
assertEquals(11, channel.position());
|
||||
|
||||
channel.position(4);
|
||||
assertEquals(4, channel.position());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenGetFileSize_thenCorrect() throws IOException {
|
||||
|
||||
try (RandomAccessFile reader = new RandomAccessFile("src/test/resources/test_read.in", "r");
|
||||
FileChannel channel = reader.getChannel();) {
|
||||
|
||||
// the original file is 11 bytes long, so that's where the position pointer should be
|
||||
assertEquals(11, channel.size());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenTruncateFile_thenCorrect() throws IOException {
|
||||
String input = "this is a test input";
|
||||
|
||||
FileOutputStream fout = new FileOutputStream("src/test/resources/test_truncate.txt");
|
||||
FileChannel channel = fout.getChannel();
|
||||
|
||||
ByteBuffer buff = ByteBuffer.wrap(input.getBytes());
|
||||
channel.write(buff);
|
||||
buff.flip();
|
||||
|
||||
channel = channel.truncate(5);
|
||||
assertEquals(5, channel.size());
|
||||
|
||||
fout.close();
|
||||
channel.close();
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
### Relevant Articles:
|
||||
- [Introduction to the Java NIO2 File API](http://www.baeldung.com/java-nio-2-file-api)
|
||||
- [Java NIO2 Path API](http://www.baeldung.com/java-nio-2-path)
|
||||
- [A Guide To NIO2 Asynchronous File Channel](http://www.baeldung.com/java-nio2-async-file-channel)
|
||||
- [Guide to Selenium with JUnit / TestNG](http://www.baeldung.com/java-selenium-with-junit-and-testng)
|
||||
- [A Guide to NIO2 Asynchronous Socket Channel](http://www.baeldung.com/java-nio2-async-socket-channel)
|
||||
- [A Guide To NIO2 FileVisitor](http://www.baeldung.com/java-nio2-file-visitor)
|
||||
- [A Guide To NIO2 File Attribute APIs](http://www.baeldung.com/java-nio2-file-attribute)
|
||||
- [How to use the Spring FactoryBean?](http://www.baeldung.com/spring-factorybean)
|
||||
- [A Guide to WatchService in Java NIO2](http://www.baeldung.com/java-nio2-watchservice)
|
||||
- [Guide to Java NIO2 Asynchronous Channel APIs](http://www.baeldung.com/java-nio-2-async-channels)
|
|
@ -1 +0,0 @@
|
|||
this
|
|
@ -1 +0,0 @@
|
|||
Hello world
|
|
@ -4,10 +4,11 @@ This module contains articles about networking in Java
|
|||
|
||||
### Relevant Articles
|
||||
|
||||
- [Checking if a URL Exists in Java](https://www.baeldung.com/java-check-url-exists)
|
||||
- [Making a JSON POST Request With HttpURLConnection](https://www.baeldung.com/httpurlconnection-post)
|
||||
- [Checking If a URL Exists in Java](https://www.baeldung.com/java-check-url-exists)
|
||||
- [Making a JSON POST Request with HttpURLConnection](https://www.baeldung.com/httpurlconnection-post)
|
||||
- [Using Curl in Java](https://www.baeldung.com/java-curl)
|
||||
- [Do a Simple HTTP Request in Java](http://www.baeldung.com/java-http-request)
|
||||
- [Sending Emails with Java](http://www.baeldung.com/java-email)
|
||||
- [Do a Simple HTTP Request in Java](https://www.baeldung.com/java-http-request)
|
||||
- [Sending Emails with Java](https://www.baeldung.com/java-email)
|
||||
- [Authentication with HttpUrlConnection](https://www.baeldung.com/java-http-url-connection)
|
||||
- [Download a File from an URL in Java](https://www.baeldung.com/java-download-file)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-networking)
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung.core-java-modules</groupId>
|
||||
<artifactId>core-java-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-java</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -27,6 +28,11 @@
|
|||
<artifactId>mail</artifactId>
|
||||
<version>${javax.mail.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.asynchttpclient</groupId>
|
||||
<artifactId>async-http-client</artifactId>
|
||||
<version>${async-http-client.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -36,5 +42,6 @@
|
|||
<properties>
|
||||
<httpclient.version>4.5.9</httpclient.version>
|
||||
<javax.mail.version>1.5.0-b01</javax.mail.version>
|
||||
<async-http-client.version>2.4.5</async-http-client.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.asynchttpclient.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
|
@ -1,8 +1,10 @@
|
|||
package com.baeldung.download;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.After;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
|
@ -11,11 +13,7 @@ import java.security.MessageDigest;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class FileDownloadIntegrationTest {
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
## Core Java NIO
|
||||
|
||||
This module contains articles about core Java non-blocking input and output (IO)
|
||||
|
||||
## Relevant Articles:
|
||||
|
||||
- [A Guide to WatchService in Java NIO2](https://www.baeldung.com/java-nio2-watchservice)
|
||||
- [Create a Symbolic Link with Java](https://www.baeldung.com/java-symlink)
|
||||
- [Introduction to the Java NIO Selector](https://www.baeldung.com/java-nio-selector)
|
||||
- [Using Java MappedByteBuffer](https://www.baeldung.com/java-mapped-byte-buffer)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-nio)
|
|
@ -0,0 +1,17 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>core-java-nio-2</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<name>core-java-nio-2</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-java</relativePath>
|
||||
</parent>
|
||||
|
||||
</project>
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio.selector;
|
||||
package com.baeldung.selector;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio.selector;
|
||||
package com.baeldung.selector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
|
@ -6,9 +6,11 @@ import java.nio.file.DirectoryStream;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import static java.nio.file.StandardOpenOption.*;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static java.nio.file.StandardOpenOption.CREATE;
|
||||
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
|
||||
|
||||
public class SymLinkExample {
|
||||
|
||||
public void createSymbolicLink(Path link, Path target) throws IOException {
|
|
@ -1,13 +1,7 @@
|
|||
package com.baeldung.java.nio2.watcher;
|
||||
package com.baeldung.watcher;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardWatchEventKinds;
|
||||
import java.nio.file.WatchEvent;
|
||||
import java.nio.file.WatchKey;
|
||||
import java.nio.file.WatchService;
|
||||
import java.nio.file.*;
|
||||
|
||||
public class DirectoryWatcherExample {
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
package com.baeldung.java.nio.selector;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
package com.baeldung.selector;
|
||||
|
||||
import com.baeldung.selector.EchoClient;
|
||||
import com.baeldung.selector.EchoServer;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class NioEchoLiveTest {
|
||||
|
||||
private Process server;
|
|
@ -1,13 +1,13 @@
|
|||
package com.baeldung.symlink;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class SymLinkExampleManualTest {
|
||||
|
|
@ -5,4 +5,13 @@ This module contains articles about core Java non-blocking input and output (IO)
|
|||
## Relevant Articles:
|
||||
|
||||
- [Determine File Creation Date in Java](https://www.baeldung.com/java-file-creation-date)
|
||||
- [Find the Number of Lines in a File Using Jav](https://www.baeldung.com/java-file-number-of-lines)
|
||||
- [Find the Number of Lines in a File Using Java](https://www.baeldung.com/java-file-number-of-lines)
|
||||
- [A Guide to NIO2 Asynchronous File Channel](https://www.baeldung.com/java-nio2-async-file-channel)
|
||||
- [A Guide to NIO2 FileVisitor](https://www.baeldung.com/java-nio2-file-visitor)
|
||||
- [Guide to Java FileChannel](https://www.baeldung.com/java-filechannel)
|
||||
- [A Guide to NIO2 File Attribute APIs](https://www.baeldung.com/java-nio2-file-attribute)
|
||||
- [Introduction to the Java NIO2 File API](https://www.baeldung.com/java-nio-2-file-api)
|
||||
- [Java NIO2 Path API](https://www.baeldung.com/java-nio-2-path)
|
||||
- [Guide to Java NIO2 Asynchronous Channel APIs](https://www.baeldung.com/java-nio-2-async-channels)
|
||||
- [A Guide to NIO2 Asynchronous Socket Channel](https://www.baeldung.com/java-nio2-async-socket-channel)
|
||||
- [[More -->]](/core-java-modules/core-java-nio-2)
|
|
@ -13,4 +13,5 @@
|
|||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-java</relativePath>
|
||||
</parent>
|
||||
|
||||
</project>
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.visitor;
|
||||
package com.baeldung.filevisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.*;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.visitor;
|
||||
package com.baeldung.filevisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
|
@ -1,13 +1,13 @@
|
|||
package com.baeldung.file;
|
||||
package com.baeldung.lines;
|
||||
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingApacheCommonsIO;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingBufferedReader;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingGoogleGuava;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingLineNumberReader;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFileChannel;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFiles;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFilesReadAllLines;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingScanner;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingApacheCommonsIO;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingBufferedReader;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingGoogleGuava;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingLineNumberReader;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFileChannel;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFiles;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFilesReadAllLines;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingScanner;
|
||||
|
||||
public class Main {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.file;
|
||||
package com.baeldung.lines;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.async;
|
||||
package com.baeldung.async;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.async;
|
||||
package com.baeldung.async;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.async;
|
||||
package com.baeldung.async;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.async;
|
||||
package com.baeldung.async;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.async;
|
||||
package com.baeldung.asyncfilechannel;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -16,7 +16,7 @@ import java.util.concurrent.Future;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class AsyncFileIntegrationTest {
|
||||
public class AsyncFileChannelIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void givenPath_whenReadsContentWithFuture_thenCorrect() throws IOException, ExecutionException, InterruptedException {
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2.attributes;
|
||||
package com.baeldung.attributes;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.java.nio2;
|
||||
package com.baeldung.file;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.AfterClass;
|
|
@ -1,13 +1,13 @@
|
|||
package com.baeldung.file;
|
||||
package com.baeldung.lines;
|
||||
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingApacheCommonsIO;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingBufferedReader;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingGoogleGuava;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingLineNumberReader;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFileChannel;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFiles;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFilesReadAllLines;
|
||||
import static com.baeldung.file.NumberOfLineFinder.getTotalNumberOfLinesUsingScanner;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingApacheCommonsIO;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingBufferedReader;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingGoogleGuava;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingLineNumberReader;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFileChannel;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFiles;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingNIOFilesReadAllLines;
|
||||
import static com.baeldung.lines.NumberOfLineFinder.getTotalNumberOfLinesUsingScanner;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
|
@ -1,8 +1,6 @@
|
|||
package com.baeldung.java.nio2;
|
||||
package com.baeldung.path;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
@ -10,7 +8,7 @@ import java.nio.file.NoSuchFileException;
|
|||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PathManualTest {
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
*.class
|
||||
|
||||
#folders#
|
||||
/target
|
||||
/neoDb*
|
||||
/data
|
||||
/src/main/webapp/WEB-INF/classes
|
||||
*/META-INF/*
|
||||
|
||||
# Packaged files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
|
@ -0,0 +1 @@
|
|||
baeldung.com
|
2
pom.xml
2
pom.xml
|
@ -423,6 +423,7 @@
|
|||
<module>core-java-modules/core-java-io</module>
|
||||
<module>core-java-modules/core-java-io-files</module>
|
||||
<module>core-java-modules/core-java-nio</module>
|
||||
<module>core-java-modules/core-java-nio-2</module>
|
||||
<module>core-java-modules/core-java-security</module>
|
||||
<module>core-java-modules/core-java-exceptions</module>
|
||||
<module>core-java-modules/core-java-lang-syntax</module>
|
||||
|
@ -1199,6 +1200,7 @@
|
|||
<module>core-java-modules/core-java-io</module>
|
||||
<module>core-java-modules/core-java-io-files</module>
|
||||
<module>core-java-modules/core-java-nio</module>
|
||||
<module>core-java-modules/core-java-nio-2</module>
|
||||
<module>core-java-modules/core-java-security</module>
|
||||
<module>core-java-modules/core-java-exceptions</module>
|
||||
<module>core-java-modules/core-java-lang-syntax</module>
|
||||
|
|
Loading…
Reference in New Issue