我们可以将一个字节数组转换为Java中的InputStream? [英] Can we convert a byte array into an InputStream in Java?
本文介绍了我们可以将一个字节数组转换为Java中的InputStream?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以转换一个字节数组转换为Java中的InputStream?我一直在寻找在互联网上,但无法找到它。
Can we convert a byte array into an InputStream in Java? I have been looking on the internet but couldn't find it.
我有了一个InputStream作为参数的方法。
I have a method that has an InputStream as argument.
InputStream的 CPH
我的base64是连接$ C $的CD,所以我不得不用脱code将其
The InputStream cph
I have is base64 encoded so I had to decode it using
BASE64Decoder decoder = new BASE64Decoder();
byte[] decodedBytes = decoder.decodeBuffer(cph);
现在我怎么转换德codedBytes
再次的InputStream
?
推荐答案
使用<一个href=\"http://docs.oracle.com/javase/8/docs/api/java/io/ByteArrayInputStream.html\"><$c$c>ByteArrayInputStream$c$c>:
InputStream is = new ByteArrayInputStream(decodedBytes);
这篇关于我们可以将一个字节数组转换为Java中的InputStream?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文