/ Published in: Java
Read the content of the given file and return it as tring.
Expand |
Embed | Plain Text
/** * Read the content of the given file and return it as tring. * * @param filePath * the name of the file to open. */ try { char[] buf = new char[1024]; int numRead = 0; while ((numRead = reader.read(buf)) != -1) { fileData.append(buf, 0, numRead); } return fileData.toString(); } finally { reader.close(); } }
You need to login to post a comment.
