@@ -0,0 +1,1714 @@
+package me.pc.mobile.helper.v14.files;%0A%0Aimport me.pc.mobile.helper.v14.util.IoUtils;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.nio.ByteBuffer;%0Aimport java.nio.charset.Charset;%0A%0Apublic final class Reader %7B%0A%0A%09private Reader() %7B%7D%0A%0A%09// =========================================================================%0A%09// Read file from external storage - uses the Java API for files%0A%09// =========================================================================%0A%09public static String read(String filename, String csName)%0A%09%09%09throws IOException %7B%0A%09%09final Charset cs = Charset.forName(csName);%0A%09%09final byte%5B%5D ba = readFile(filename, new InputStreamAction());%0A%09%09return cs.newDecoder().decode(ByteBuffer.wrap(ba)).toString();%0A%09%7D%0A%0A%09public static byte%5B%5D read(String filename) throws IOException %7B%0A%09%09return readFile(filename, new InputStreamAction());%0A%09%7D%0A%0A%09private static byte%5B%5D readFile(String filename,%0A%09%09%09InputStreamAction action) throws IOException %7B%0A%09%09InputStream stream = new FileInputStream(filename);%0A%09%09try %7B%0A%09%09%09return action.useStream(stream);%0A%09%09%7D finally %7B%0A%09%09%09IoUtils.closeSilently(stream);%0A%09%09%7D%0A%09%7D%0A%7D%0A%0Aclass InputStreamAction %7B%0A%0A%09/**%0A%09 * Based on code by Skeet for reading a file to a string :%0A%09 * http://stackoverflow.com/a/326531/281545%0A%09 *%0A%09 * @param stream%0A%09 * @return%0A%09 * @throws IOException%0A%09 */%0A%09byte%5B%5D useStream(InputStream stream) throws IOException %7B%0A%09%09final ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A%09%09final int length = 8192;%0A%09%09byte%5B%5D buffer = new byte%5Blength%5D;%0A%09%09int read;%0A%09%09while ((read = stream.read(buffer, 0, length)) %3E 0) %7B%0A%09%09%09baos.write(buffer, 0, read);%0A%09%09%7D%0A%09%09return baos.toByteArray();%0A%09%7D%0A%7D%0A

Create Reader.java