Java BufferedInputStream Create getInputStream(InputStream in)

Here you can find the source of getInputStream(InputStream in)

Description

get Input Stream

License

LGPL

Declaration

private static InputStream getInputStream(InputStream in) throws Throwable 

Method Source Code

//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);
    }
}

Related

  1. getInputStream(byte[] data)
  2. getInputStream(byte[] signature)
  3. getInputStream(byte[]... data)
  4. getInputStream(File file)
  5. getInputStream(final String path)
  6. getInputStream(String path)
  7. getInputStream(String resource)
  8. getInputStream(String string)
  9. getInputstreamForZipEntry(ZipFile zipFile, String uri)