Java BufferedReader Read readfile(String filename)

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

Description

readfile

License

Open Source License

Declaration

static public String readfile(String filename) throws IOException 

Method Source Code


//package com.java2s;
/* Copyright 2012, UCAR/Unidata.
   See the LICENSE file for more information.
*///from  w w w  .java2 s  .c o  m

import java.io.*;

public class Main {
    static public String readfile(String filename) throws IOException {
        StringBuilder buf = new StringBuilder();
        FileReader file = new FileReader(filename);
        BufferedReader rdr = new BufferedReader(file);
        String line;
        while ((line = rdr.readLine()) != null) {
            if (line.startsWith("#"))
                continue;
            buf.append(line + "\n");
        }
        return buf.toString();
    }
}

Related

  1. readFile(String file)
  2. readFile(String file, Boolean deleteOnExit)
  3. readFile(String fileDir)
  4. readFile(String filename)
  5. readFile(String filename)
  6. readFile(String fileName)
  7. readFile(String filename)
  8. readFile(String filename)
  9. readFile(String filename)