Java File Content Read getFileContent(String pythonSource)

Here you can find the source of getFileContent(String pythonSource)

Description

get File Content

License

Open Source License

Declaration

public static String getFileContent(String pythonSource) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;
import java.io.File;

import java.io.FileReader;

import java.io.IOException;

public class Main {
    public static String getFileContent(String pythonSource) {
        StringBuffer result = new StringBuffer();
        try {//  w  ww  .j ava 2  s . c  o  m
            FileReader reader = new FileReader(new File(pythonSource));
            BufferedReader br = new BufferedReader(reader);
            String line = br.readLine();
            while (line != null) {
                result.append("\n" + line);
                line = br.readLine();
            }
            br.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return result.toString();
    }
}

Related

  1. getFileContent(String path)
  2. getFileContent(String path)
  3. getFileContent(String path)
  4. getFileContent(String path)
  5. getFileContent(String path, String encoding)
  6. getFileContents(File f)
  7. getFileContents(File f)
  8. getFileContents(File file)
  9. getFileContents(File file)