Here you can find the source of toInputStream(OutputStream out)
Parameter | Description |
---|---|
out | a parameter |
public static InputStream toInputStream(OutputStream out)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; public class Main { /**/* w w w . j a v a2 s. co m*/ * * OutputStream -> InputStream * * @param out * @return */ public static InputStream toInputStream(OutputStream out) { ByteArrayInputStream result = null; if (out instanceof ByteArrayOutputStream) { try { result = new ByteArrayInputStream( ((ByteArrayOutputStream) out).toByteArray()); } catch (Exception ex) { ex.printStackTrace(); } } return result; } }