java.io.Filejava.nio.file.Paths



Project apache/lucene-solr in file ....lucene.benchmark.byTask.tasks.AddIndexesTask.java (2014-09-13)
@@ -17,7 +17,7 @@ package org.apache.lucene.benchmark.byTask.tasks;
  * limitations under the License.
  */
 
-import java.io.File;
+import java.nio.file.Paths;
 
 import org.apache.lucene.benchmark.byTask.PerfRunData;
 import org.apache.lucene.index.DirectoryReader;
@@ -54,7 +54,7 @@ public class AddIndexesTask extends PerfTask {
     if (inputDirProp == null) {
       throw new IllegalArgumentException("config parameter " + ADDINDEXES_INPUT_DIR + " not specified in configuration");
     }
-    inputDir = FSDirectory.open(new File(inputDirProp));
+    inputDir = FSDirectory.open(Paths.get(inputDirProp));
   }
   
   @Override
Project apache/lucene-solr in file ...ucene.benchmark.byTask.tasks.WriteLineDocTask.java (2014-09-13)
@@ -18,11 +18,11 @@ package org.apache.lucene.benchmark.byTask.tasks;
  */
 
 import java.io.BufferedWriter;
-import java.io.File;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.regex.Matcher;
@@ -101,7 +101,7 @@ public class WriteLineDocTask extends PerfTask {
     if (fname == null) {
       throw new IllegalArgumentException("line.file.out must be set");
     }
-    OutputStream out = StreamUtils.outputStream(new File(fname));
+    OutputStream out = StreamUtils.outputStream(Paths.get(fname));
     lineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8), StreamUtils.BUFFER_SIZE));
     docMaker = runData.getDocMaker();
     
Project apache/lucene-solr in file ....benchmark.quality.utils.QualityQueriesFinder.java (2014-09-13)
@@ -16,8 +16,8 @@
  */
 package org.apache.lucene.benchmark.quality.utils;
 
-import java.io.File;
 import java.io.IOException;
+import java.nio.file.Paths;
 
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
@@ -54,7 +54,7 @@ public class QualityQueriesFinder {
       System.err.println("Usage: java QualityQueriesFinder <index-dir>");
       System.exit(1);
     }
-    QualityQueriesFinder qqf = new QualityQueriesFinder(FSDirectory.open(new File(args[0])));
+    QualityQueriesFinder qqf = new QualityQueriesFinder(FSDirectory.open(Paths.get(args[0])));
     String q[] = qqf.bestQueries("body",20);
     for (int i=0; i<q.length; i++) {
       System.out.println(newline+formatQueryAsTrecTopic(i,q[i],null,null));
Project apache/lucene-solr in file ...ache.lucene.facet.taxonomy.PrintTaxonomyStats.java (2014-09-13)
@@ -17,9 +17,9 @@ package org.apache.lucene.facet.taxonomy;
  * limitations under the License.
  */
 
-import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.nio.file.Paths;
 
 import org.apache.lucene.facet.taxonomy.TaxonomyReader.ChildrenIterator;
 import org.apache.lucene.facet.taxonomy.directory.DirectoryTaxonomyReader;
@@ -50,7 +50,7 @@ public class PrintTaxonomyStats {
       System.out.println("\nUsage: java -classpath ... org.apache.lucene.facet.util.PrintTaxonomyStats [-printTree] /path/to/taxononmy/index\n");
       System.exit(1);
     }
-    Directory dir = FSDirectory.open(new File(path));
+    Directory dir = FSDirectory.open(Paths.get(path));
     TaxonomyReader r = new DirectoryTaxonomyReader(dir);
     printStats(r, System.out, printTree);
     r.close();
Project apache/lucene-solr in file ...c.src.java.org.apache.lucene.misc.GetTermInfo.java (2014-09-13)
@@ -17,7 +17,7 @@ package org.apache.lucene.misc;
  * limitations under the License.
  */
 
-import java.io.File;
+import java.nio.file.Paths;
 import java.util.Locale;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
@@ -37,7 +37,7 @@ public class GetTermInfo {
     String field = null;
     
     if (args.length == 3) {
-      dir = FSDirectory.open(new File(args[0]));
+      dir = FSDirectory.open(Paths.get(args[0]));
       field = args[1];
       inputStr = args[2];
     } else {