code: public static InputStream openFromFile(final File file) {
      try {
        InputStream is = new BufferedInputStream(new FileInputStream(file),
            BUFFER_SIZE);
        if (file.getName().endsWith(".gz") || file.getName().endsWith("gz")) {
          is = new GZIPInputStream(is, BUFFER_SIZE);
        }
        return is;
      } catch (final IOException e) {
        throw new TerminateToolException(-1,
            "File '" + file + "' cannot be found", e);
      }
    }
docs: Open file to an input stream.
  
  @param file
  the file
  @return the input stream