List of utility methods to do File to InputStream
FileInputStream | newInputStream(File file) new Input Stream try { return new FileInputStream(file); } catch (Exception e) { e.printStackTrace(); return null; |
InputStream | newInputStream(File file) new Input Stream try { return new BufferedInputStream(new FileInputStream(file)); } catch (IOException e) { throw new RuntimeException(e); |
FileInputStream | openInputStream(File file) open Input Stream FileInputStream stream = new FileInputStream(file); return stream; |
FileInputStream | openInputStream(File file) open Input Stream if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); if (file.canRead() == false) { throw new IOException("File '" + file + "' cannot be read"); } else { ... |
FileInputStream | openInputStream(File file) Opens a FileInputStream for the specified file, providing better error messages than simply calling new FileInputStream(file) .
if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); if (file.canRead() == false) { throw new IOException("File '" + file + "' cannot be read"); } else { ... |
FileInputStream | openInputStream(File file) Open InputStream for a file. if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); if (!file.canRead()) { throw new IOException("File '" + file + "' cannot be read"); } else { return new FileInputStream(file); ... |
InputStream | openInputStream(File file, boolean buffer) Opens an InputStream on a file for reading. return openInputStream(file, buffer, BUFFER_SIZE);
|
FileInputStream | openInputStream(File file, boolean refuseEmpty) open Input Stream if (file != null && file.exists() && refuseEmpty && file.length() == 0) throw new IllegalArgumentException("File \"" + file.getAbsolutePath() + "\" is empty!"); return new FileInputStream(file); |
FileInputStream | openInputStream(String filePath) open Input Stream return openInputStream(new File(filePath)); |
FileInputStream | openInputStream(String infilename) open Input Stream FileInputStream fis = null; try { fis = new FileInputStream(infilename); } catch (IOException ioe) { System.out.println(ioe.getMessage()); return fis; |