Best code examples for Java 8 FileReader class (java.io.FileReader)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 FileReader class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 FileReader examples from Open Source projects
This code example shows how to use the following methods:
		return child;
	} 
	 
	@SuppressWarnings("unchecked") 
	public static Map<String, Object> parseJSON(String path) throws FileNotFoundException {
		return (Map<String, Object>) JSONValue.parse(new FileReader(path));
	} 
} 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods:
 
        // Export to JSON and verify 
        File tempJson = File.createTempFile("Standard1", ".json");
        SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[]{asHex("rowExclude")});
 
        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        assertEquals("unexpected number of rows", 2, json.size());
 
        JSONObject rowA = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 2, rowA.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),rowA.get("key"));
 
        JSONArray colsA = (JSONArray)rowA.get("columns");
        JSONArray colA = (JSONArray)colsA.get(0);
        assert hexToBytes((String)colA.get(1)).equals(ByteBufferUtil.bytes("valA"));
 
        JSONArray colExp = (JSONArray)colsA.get(1);
        assert ((Long)colExp.get(4)) == 42;
        assert ((Long)colExp.get(5)) == nowInSec;
 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods:
        Assert.assertTrue("File exists: " + outfile, outfile.exists());
 
        File xmlfile = new File("target/subsystem-modules.xml");
        Assert.assertTrue("File exists: " + xmlfile, xmlfile.exists());
 
        BufferedReader br = new BufferedReader(new FileReader(outfile));
        Assert.assertEquals("javax/servlet/api/main/**", br.readLine());
        Assert.assertEquals("org/apache/commons/logging/main/**", br.readLine());
        Assert.assertEquals("org/jboss/as/osgi/main/**", br.readLine());
        Assert.assertEquals("org/jboss/as/web/main/**", br.readLine());
        Assert.assertEquals("org/jboss/osgi/framework/main/**", br.readLine());
        Assert.assertEquals("org/osgi/core/main/**", br.readLine());
        Assert.assertEquals("org/slf4j/jcl-over-slf4j/main/**", br.readLine());
        Assert.assertEquals("org/slf4j/main/**", br.readLine());
        Assert.assertNull(br.readLine());
    } 
 
    @Test 
    public void testSkipSubsystems() throws Exception { 
 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods:
 * @author Marko A. Rodriguez (http://markorodriguez.com) 
 */ 
public class ScriptExecutorTest extends TestCase {
 
    public void testVariableAllocation() throws Exception {
        ScriptExecutor.evaluate(new FileReader(new File(ScriptExecutorTest.class.getResource("Script.groovy").toURI())), Arrays.<String>asList("this ", "is ", "gremlin"));
    } 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
        Connection conn = Transaction.getStandaloneConnection();
         
        ScriptRunner runner = new ScriptRunner(conn, autoCommit, stopOnError);
        FileReader reader;
        try { 
            reader = new FileReader(cleanScript);
        } catch (FileNotFoundException e) {
            throw new RuntimeException("Unable to read " + file, e);
        }  
        try { 
            runner.runScript(reader);
        } catch (IOException e) {
            throw new RuntimeException("Unable to read " + file, e);
        } catch (SQLException e) {
            throw new RuntimeException("Unable to execute " + file, e);
        } 
         
        try { 
            conn.close();
        } catch (SQLException e) {
Full Snippet Info
7
CodeRank
Related Java 8 FileReader Questions & Answers:
Other Java 8 FileReader Examples
8:	  BufferedReader reader = null;
9:	  try {
10:	    reader = new BufferedReader(new FileReader(file));
11:	    StringBuilder builder = new StringBuilder();
12:	    String line;

Read More