Here you can find the source of fileToStream(final File file)
public static InputStream fileToStream(final File file)
//package com.java2s; //License from project: Apache License import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { /**//from ww w .j av a 2 s .c o m * Reads a file and returns it as a stream. */ public static InputStream fileToStream(final File file) { try { return new BufferedInputStream(new FileInputStream(file)); } catch (final IOException ioEx) { // Wrap it throw new RuntimeException(ioEx); } } }