Java InputStream Create getInputStream(String inputFile)

Here you can find the source of getInputStream(String inputFile)

Description

get Input Stream

License

Creative Commons License

Declaration

public static InputStream getInputStream(String inputFile) throws FileNotFoundException, IOException 

Method Source Code

//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);
        }
    }
}

Related

  1. getInputStream(String filename)
  2. getInputStream(String filename)
  3. getInputStream(String filePath)
  4. getInputStream(String fileType, String fileName)
  5. getInputStream(String fname, String enc)
  6. getInputStream(String location)
  7. getInputStream(String parentFolder, String fileName)
  8. getInputStream(String path)
  9. getInputStream(String path)