Java 8 FileReader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 FileReader class.

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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
Stop searching for code, let great code find you!  Add Codota to your java IDE
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
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, read
     * @return new increased number 
     */ 
    public int increaseFileCounter() { 
        int callsCounter = -1;
        try { 
            FileReader reader = new FileReader(counterFile);
            callsCounter = reader.read();
            reader.close();
            callsCounter++;
            FileWriter writer = new FileWriter(counterFile);
            writer.write(callsCounter);
            writer.close();
        } catch (IOException ex) {
            throw new RuntimeException("File for counting IO exception", ex);
        } 
 
        return callsCounter;
    } 
 
    /** 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		if (fileName.endsWith(".java")) {
			fileName = fileName.substring(0, fileName.length() - 5);
		} 
 
		return getClasses( 
			new UnsyncBufferedReader(new FileReader(file)), fileName);
	} 
 
	public static Set<String> getClasses(Reader reader, String className)
		throws IOException {
 
		Set<String> classes = new HashSet<String>();
 
		StreamTokenizer st = new StreamTokenizer(reader);
 
		_setupParseTableForAnnotationProcessing(st);
 
		while (st.nextToken() != StreamTokenizer.TT_EOF) {
			if (st.ttype == StreamTokenizer.TT_WORD) {
				if (st.sval.equals("class") || st.sval.equals("enum") ||
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close
 
	@SuppressWarnings("unchecked") 
	protected void loadBindings(String jsonPath)
		throws ParseException, IOException 
	{ 
		FileReader reader = new FileReader(jsonPath);
		Map<String, Object> properties = (Map<String, Object>)
			JSONValue.parseWithException(reader);
		reader.close();
 
		Map<String, Object> proxies = jsonUtils.getStringMap(properties, "proxies");
		Map<String, Object> modules = jsonUtils.getStringMap(properties, "modules");
 
		this.proxies.putAll(proxies);
		mergeModules(modules);
	} 
 
	@SuppressWarnings("unchecked") 
	protected void loadTitaniumBindings() 
		throws ParseException, IOException, URISyntaxException 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    DevRelayConfigGenerator.generateRelayConfig(schemaDir.getAbsolutePath(), "example", uri, schemaDir.getAbsolutePath(), exampleSrcs, mgr);
 
    File f = new File(schemaDir.getAbsolutePath() + "/sources-example.json");
    Assert.assertTrue( f.exists(),"Physical Src Config file present?");
 
    BufferedReader r = new BufferedReader(new FileReader(f));
 
    String json = r.readLine();
    PhysicalSourceConfig config = PhysicalSourceConfig.fromString(json);
    config.checkForNulls();
 
    Assert.assertEquals(config.getUri(), uri);
    Assert.assertEquals(config.getName(), "example");
 
    List<LogicalSourceConfig> srcs = config.getSources();
    Assert.assertEquals(srcs.size(),2 );
    Assert.assertEquals(srcs.get(0).getId(), 1);
    Assert.assertEquals(srcs.get(0).getName(), "com.linkedin.events.example.person");
    Assert.assertEquals(srcs.get(0).getUri(), "example.sy$person");
    Assert.assertEquals(srcs.get(1).getId(), 2);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

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

See Code Examples for Java 8 FileReader Methods: