Here you can find the source of toInputStream(byte[] data)
public static InputStream toInputStream(byte[] data)
//package com.java2s; /*/* w w w . j a v a 2 s . c o m*/ * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.InputStream; public class Main { /** * converts the byte array to an input stream */ public static InputStream toInputStream(byte[] data) { ByteArrayInputStream bais = new ByteArrayInputStream(data); InputStream isContent = new BufferedInputStream(bais); return isContent; } }