Changeset 30921
- Timestamp:
- 2016-10-25T23:23:08+13:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PagedJSON.java
r30918 r30921 8 8 import java.io.InputStreamReader; 9 9 import java.io.UnsupportedEncodingException; 10 import java.net.URI; 10 11 import java.nio.charset.StandardCharsets; 11 import java.nio.file.Files;12 import java.nio.file.Path;13 import java.nio.file.Paths;12 //import java.nio.file.Files; 13 //import java.nio.file.Path; 14 //import java.nio.file.Paths; 14 15 import java.util.ArrayList; 15 16 import java.util.Arrays; … … 20 21 import org.apache.commons.compress.compressors.CompressorInputStream; 21 22 import org.apache.commons.compress.compressors.CompressorStreamFactory; 23 import org.apache.hadoop.conf.Configuration; 24 import org.apache.hadoop.fs.FSDataInputStream; 25 import org.apache.hadoop.fs.FileSystem; 26 import org.apache.hadoop.fs.Path; 22 27 import org.apache.spark.api.java.function.FlatMapFunction; 23 28 import org.json.JSONArray; … … 35 40 36 41 /* 37 URI uri = URI.create ( âhdfs://host:port/file pathâ);42 URI uri = URI.create ("hdfs://host:port/file path"); 38 43 Configuration conf = new Configuration(); 39 44 FileSystem file = FileSystem.get(uri, conf); … … 54 59 55 60 protected static BufferedReader getBufferedReaderForCompressedFile(String fileIn) 56 throws FileNotFoundException, UnsupportedEncodingException, CompressorException { 57 FileInputStream fin = new FileInputStream(fileIn); 61 throws CompressorException, IOException 62 { 63 URI uri = URI.create (fileIn); 64 Configuration conf = new Configuration(); 65 FileSystem file = FileSystem.get(uri, conf); 66 FSDataInputStream fin = file.open(new Path(uri)); 67 68 //FileInputStream fin = new FileInputStream(fileIn); 58 69 BufferedInputStream bis = new BufferedInputStream(fin); 59 70 CompressorInputStream input = new CompressorStreamFactory().createCompressorInputStream(bis);
Note:
See TracChangeset
for help on using the changeset viewer.