Here you can find the source of getInputStream(FileInputStream fileInput)
public static InputStream getInputStream(FileInputStream fileInput)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class Main { public static InputStream getInputStream(FileInputStream fileInput) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024 * 4]; int n = -1; InputStream inputStream = null; try {//from ww w .j a v a2s . co m while ((n = fileInput.read(buffer)) != -1) { baos.write(buffer, 0, n); } byte[] byteArray = baos.toByteArray(); inputStream = new ByteArrayInputStream(byteArray); return inputStream; } catch (FileNotFoundException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } }