Here you can find the source of getInputStream(String inputFile)
public static InputStream getInputStream(String inputFile) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Creative Commons License import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; public class Main { public static InputStream getInputStream(String inputFile) throws FileNotFoundException, IOException { if (inputFile.endsWith(".gz")) { return new GZIPInputStream(new FileInputStream(inputFile)); } else if (inputFile.equals("stdin")) { return System.in; } else {// w w w. j a v a2 s. c o m return new FileInputStream(inputFile); } } }