code: public static InputStream openFile(File file) throws IOException {
  		final InputStream is;
  		if(!file.isFile()) {
  			throw new ParserException("The file "+file+" is not a file.");
  		}
  		String name = file.getName();
  
  		if(name.endsWith(".gz")) {
  			is = new GZIPInputStream(new FileInputStream(file));
  		}
  		else {
  			is = new FileInputStream(file);
  		}
  
  		return is;
  	}
docs: For a filename this code will check the extension of the file for a
  .gz extension. If it finds one then the InputStream given back
  is a {@link GZIPInputStream}. Otherwise we return a normal
  {@link FileInputStream}.
  
  @param file File which may or may not be GZipped
  @return The final stream
  @throws IOExceptio n