List of utility methods to do File Content Get
List | getFileContent(String fileName) Gets the content from a File as StringArray List. List<String> result = new ArrayList<String>(); File aFile = new File(fileName); if (!aFile.isFile()) { return result; BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(aFile)); ... |
String | getFileContent(String filePath) get File Content Writer swriter = null; Reader reader = null; try { reader = new FileReader(filePath); swriter = new StringWriter(); int len = 0; char[] buffer = new char[1024]; while ((len = reader.read(buffer)) != -1) { ... |
String | getFileContent(String filePath, String charSet) get File Content return getFileContent(new File(filePath), charSet); |
void | printFileContent(String filePath) print File Content File file = new File(filePath); BufferedReader reader = null; try { 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(); |