我通过套接字发送一个对象,该套接字是以下类的对象:
public class ClientDetail implements Serializable{
public String username;
public String [] capturedText;
public String site;
public BufferedImage screenShot;
}
我试图使用以下内容发送它:
ClientDetail cD = new ClientDetail();
cD.capturedText = mon.getCapturedText();
cD.username = username;
cD.site = mon.getWebsite();
ScreenShot ss = new ScreenShot();
cD.screenShot = ss.getScreenShot();
if(mon.isCaptured)
{
try{
output.writeObject(cD);
output.flush();
}catch(IOException ex){
System.out.println("\nSomething messed up sending the message!");
}
}
这是发送失败。你可以通过套接字发送包含图像的对象吗?
答案 0 :(得分:0)
发送东西:
ImageIO.write((RenderedImage) image, "png", output);
您知道的接收器内容:
ImageIO.read(input);