Ignore:
Timestamp:
2017-01-21T21:18:02+13:00 (7 years ago)
Author:
davidb
Message:

Initial cut at files for working with MongoDB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/solr-ingest/src/main/java/org/hathitrust/extractedfeatures/ClusterFileIO.java

    r31228 r31310  
    2121import org.apache.hadoop.fs.FileSystem;
    2222import org.apache.hadoop.fs.Path;
     23import org.json.JSONObject;
    2324
    2425public class ClusterFileIO {
     
    154155    }
    155156
     157    protected static String readTextFile(String filename)
     158    {
     159        StringBuilder sb = new StringBuilder();
     160       
     161        try {   
     162            BufferedReader br = ClusterFileIO.getBufferedReaderForCompressedFile(filename);
     163
     164            int cp;
     165            while ((cp = br.read()) != -1) {
     166                sb.append((char) cp);
     167            }
     168   
     169            br.close();
     170        }
     171        catch (Exception e) {
     172            e.printStackTrace();
     173        }
     174       
     175        return sb.toString();
     176    }
     177   
    156178    public static BufferedOutputStream getBufferedOutputStream(String fileOut)
    157179            throws IOException
Note: See TracChangeset for help on using the changeset viewer.