Java FileReader Read load(String filename)

Here you can find the source of load(String filename)

Description

load

License

Open Source License

Declaration

protected static String load(String filename) 

Method Source Code

//package com.java2s;
/*//  w ww . jav  a  2 s.c o  m
 * WAVE - Web Application Visual Environment
 * A Graphical Modeling Framework (GMF) Plugin for Eclipse
 * Copyright Jens Gulden, 2009, mail@jensgulden.de
 * Licensed under the GNU General Public License (GPL)
 */

import java.io.FileReader;

import java.io.IOException;

public class Main {
    protected static String load(String filename) {
        try {
            FileReader f = new FileReader(filename);
            char[] buf = new char[10 * 1024];
            StringBuffer s = new StringBuffer();
            int hasread = f.read(buf);
            while (hasread != -1) {
                s.append(buf, 0, hasread);
                hasread = f.read(buf);
            }
            f.close();
            return s.toString();
        } catch (IOException ioe) {
            return null;
        }
    }
}

Related

  1. load(String fileName, Class klass)
  2. loadIndex(File root_)
  3. loadJSON(File file)
  4. loadKeggInteractions(String species, String location)