Android的转换位图的BufferedInputStream [英] android convert bitmap to bufferedinputstream
本文介绍了Android的转换位图的BufferedInputStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
福利局问题;
我有在内存中的位图;
I've got a bitmap in memory;
Private Bitmap MyPicture;
后来的后来,我填从相机成像的MyPicture。我需要使用FTP客户端从Apache公地,上载照片。
Then later, I fill that MyPicture from imager from the camera. I need to upload that photo using the FTP client from the apache commons.
fcon.storeFile("filename", new BufferedInputStream(MyPicture.????));
但阿帕奇希望的BufferedInputStream。如何转换的内存位图到内存流?
But the apache want a BufferedInputStream. How do I convert the memory Bitmap to a memory stream?
谢谢你们!
推荐答案
这就是我一直在寻找;
This is what I was looking for;
ByteArrayOutputStream stream = new ByteArrayOutputStream();
si.Image.compress(CompressFormat.JPEG, 100, stream);
InputStream is = new ByteArrayInputStream(stream.toByteArray());
最后一行是缺失的一环......
The last line was the missing link...
这篇关于Android的转换位图的BufferedInputStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文