Switch to calling Files.newBufferedReader()
This is, in part, a follow-up to db21e3add0
.
FileReader is a thin wrapper of FileInputStream.
Change-Id: I342de223f1d18bff80a3cb09ee0f66641e2c4807
This commit is contained in:
parent
ba64b50db8
commit
d7fbfbe27d
@ -12,10 +12,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -150,7 +151,7 @@ public class AsciiDoctor {
|
||||
}
|
||||
|
||||
if (revnumberFile != null) {
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(revnumberFile))) {
|
||||
try (BufferedReader reader = Files.newBufferedReader(revnumberFile.toPath(), UTF_8)) {
|
||||
revnumber = reader.readLine();
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,7 @@ import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
@ -105,8 +103,7 @@ public class DocIndexer {
|
||||
}
|
||||
|
||||
String title;
|
||||
try (BufferedReader titleReader =
|
||||
new BufferedReader(new InputStreamReader(Files.newInputStream(file.toPath()), UTF_8))) {
|
||||
try (BufferedReader titleReader = Files.newBufferedReader(file.toPath(), UTF_8)) {
|
||||
title = titleReader.readLine();
|
||||
if (title != null && title.startsWith("[[")) {
|
||||
// Generally the first line of the txt is the title. In a few cases the
|
||||
@ -120,7 +117,7 @@ public class DocIndexer {
|
||||
}
|
||||
|
||||
String outputFile = AsciiDoctor.mapInFileToOutFile(inputFile, inExt, outExt);
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
try (BufferedReader reader = Files.newBufferedReader(file.toPath(), UTF_8)) {
|
||||
Document doc = new Document();
|
||||
doc.add(new TextField(Constants.DOC_FIELD, reader));
|
||||
doc.add(new StringField(Constants.URL_FIELD, prefix + outputFile, Field.Store.YES));
|
||||
|
Loading…
Reference in New Issue
Block a user