Skip to content

Commit

Permalink
Use NIO2 APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Feb 20, 2024
1 parent 75b26b1 commit 568c8eb
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.lucene.backward_index;

import com.carrotsearch.randomizedtesting.annotations.Name;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.LineNumberReader;
Expand All @@ -27,6 +26,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -265,7 +265,10 @@ public final void createBWCIndex() throws IOException {
Path tmpDir = createTempDir();

try (Directory dir = FSDirectory.open(tmpDir);
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFile.toFile()))) {
ZipOutputStream zipOut =
new ZipOutputStream(
Files.newOutputStream(
zipFile, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW))) {
createIndex(dir);
for (String file : dir.listAll()) {
try (IndexInput in = dir.openInput(file, IOContext.READONCE)) {
Expand Down

0 comments on commit 568c8eb

Please sign in to comment.