[英]Sending object over socket - object contains bufferedimage- Any ideas?
Im sending a object over a socket, an object of the following class: 我通过套接字发送对象,该对象是以下类的对象:
public class ClientDetail implements Serializable{
public String username;
public String [] capturedText;
public String site;
public BufferedImage screenShot;
}
and I am trying to send it using the following: 我正在尝试使用以下方式发送:
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!");
}
}
This is failing to send. 这无法发送。 Can you send an object that contains a image over a socket?
您可以通过套接字发送包含图像的对象吗?
Send thing: 发送东西:
ImageIO.write((RenderedImage) image, "png", output);
Receiver thing you know: 您知道的接收器内容:
ImageIO.read(input);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.