List of utility methods to do FileInputStream Read
InputStream | readFile(String filePath) This method reads a file at specfied path and returns its inputStream. File file = new File(filePath); return new FileInputStream(file); |
byte[] | readFile(String filePath) Reads a file. byte[] buffer = new byte[(int) new File(filePath).length()]; BufferedInputStream f = null; try { f = new BufferedInputStream(new FileInputStream(filePath)); f.read(buffer); } finally { if (f != null) { try { ... |
Object | readFile(String filePathName) read File ObjectInputStream oin = null; try { File file = new File(filePathName); if (!file.exists()) { file.createNewFile(); oin = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file))); Object obj = oin.readObject(); ... |
byte[] | readFile(String fname) read File byte[] ret; try (FileInputStream fis = new FileInputStream(fname)) { ret = readStream(fis); return ret; |
String | readFile(String fname) read File return readFile(new File(fname), default_encoding); |
String | readFile(String fname) read File try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(new FileInputStream(fname), baos); return baos.toString("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Could not read file: " + fname, e); } catch (IOException e) { throw new RuntimeException("Could not read file: " + fname, e); ... |
byte[] | readFile(String imageName) read File byte[] buf = null; try { File file = new File(imageName); buf = new byte[(int) file.length()]; FileInputStream fis = new FileInputStream(file); fis.read(buf); fis.close(); } catch (IOException e) { ... |
byte[] | readFile(String name) Read whole file. return readFile(new File(name)); |
byte[] | readFile(String path) Reads a given file into a byte array. File fileToReade = new File(path); if (fileToReade.exists()) { byte[] buffer = new byte[(int) fileToReade.length()]; FileInputStream inStream = null; try { inStream = new FileInputStream(fileToReade); inStream.read(buffer); } finally { ... |
String | Readfile(String path) Readfile try { StringBuffer readsb = new StringBuffer(); InputStream in = new FileInputStream(new File(path)); ArrayList<String> alist = new ArrayList<String>(); int count; byte[] b = new byte[1024 * 1024]; while ((count = in.read(b)) != -1) { if (count != b.length) { ... |