Android File Content Get printFileContent(String filePath)

Here you can find the source of printFileContent(String filePath)

Description

print File Content

Declaration

private static void printFileContent(String filePath) 

Method Source Code

//package com.java2s;
import java.io.*;

public class Main {
    private static void printFileContent(String filePath) {
        File file = new File(filePath);
        BufferedReader reader = null;
        try {/* ww w . j  a  va 2  s. com*/
            reader = new BufferedReader(new java.io.FileReader(file));
            String line = null;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (reader != null) {
                    reader.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Related

  1. getFileContent(String fileName)
  2. getFileContent(String filePath)
  3. getFileContent(String filePath, String charSet)