Java InputStream Create toInputStream(File file)

Here you can find the source of toInputStream(File file)

Description

to Input Stream

License

Apache License

Declaration

private static InputStream toInputStream(File file) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;

public class Main {
    private static InputStream toInputStream(File file) throws IOException {
        InputStream in = new FileInputStream(file);
        if (file.getName().endsWith(".gz")) {
            in = new GZIPInputStream(in);
        }//from w ww  .j a  va 2 s .c o m
        return in;
    }
}

Related

  1. toInputStream(byte[] data)
  2. toInputStream(CharSequence input)
  3. toInputStream(CharSequence input, String encoding)
  4. toInputStream(CharSequence input, String encoding)
  5. toInputStream(File file)
  6. toInputStream(final String content)
  7. toInputStream(final String input, final String encoding)
  8. toInputStream(OutputStream out)
  9. toInputStream(String input)