Wildcard imports are replaced by named classes and static import is removed

This commit is contained in:
Afshin 2019-10-05 21:07:21 +02:00
parent 230b2db438
commit 2bb48cbedc
2 changed files with 14 additions and 5 deletions

View File

@ -1,6 +1,12 @@
package com.baeldung.encoding;
import java.io.*;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;

View File

@ -4,7 +4,12 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.*;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.MalformedInputException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@ -15,8 +20,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import static java.nio.file.Files.newInputStream;
public class CharacterEncodingExamplesUnitTest {
@Test
@ -100,7 +103,7 @@ public class CharacterEncodingExamplesUnitTest {
allCandidateCharSets.forEach(charset -> {
try {
CharsetDecoder charsetDecoder = charset.newDecoder().onMalformedInput(CodingErrorAction.REPORT);
Reader reader = new InputStreamReader(newInputStream(path), charsetDecoder);
Reader reader = new InputStreamReader(Files.newInputStream(path), charsetDecoder);
BufferedReader bufferedReader = new BufferedReader(reader);
while (bufferedReader.readLine() != null) {
}