Here you can find the source of getInputStream(InputStream in)
private static InputStream getInputStream(InputStream in) throws Throwable
//package com.java2s; //License from project: LGPL import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; public class Main { private static InputStream getInputStream(InputStream in) throws Throwable { ByteArrayOutputStream out = new ByteArrayOutputStream(); int read = 0; while ((read = in.read()) != -1) { out.write(read);/*from w w w. ja v a2s .c om*/ } byte[] bytes = out.toByteArray(); in.close(); out.close(); out.flush(); return new ByteArrayInputStream(bytes); } }