我尝试在服务器端为android mobile.so构建RDP应用程序,我正在使用robot类发送png图像,但在客户端,我无法读取该消息并将其打印到我的安卓设备上。
我使用以下代码读取JPEG文件体数据,并能够显示这些图像
InputStream in = sock.getInputStream();
while(true)
{
byte[] bytes = new byte[1024*1024];
int count = 0;
do
{
count+= in.read(bytes,count,bytes.length-count);
}
while(!(count>4&&bytes[count-2]==(byte)-1 && bytes[count-1]==(byte)-39));
}有谁能帮我从输入流中读出png文件吗?
发布于 2012-07-06 21:01:12
尝尝这个
BufferedInputStream in = new BufferedInputStream(sock.getInputStream());
BufferedImage image = ImageIO.read(in);https://stackoverflow.com/questions/11362535
复制相似问题