Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert byte[] to InputStream? [duplicate]

Possible Duplicate:
Can we convert a byte array into an InputStream in Java?

There is a way to convert an array of bytes (byte[]) to InputStream in Java? I looked at some methods in Apache Commons IO, but found nothing.

like image 855
Renato Dinhani Avatar asked Mar 27 '12 20:03

Renato Dinhani


1 Answers

ByteArrayInputStream extends InputStream:

InputStream myInputStream = new ByteArrayInputStream(myBytes);  
like image 196
Diego Avatar answered Oct 27 '22 03:10

Diego