通过套接字发送对象 - 对象包含缓冲图像 - 任何想法



我通过套接字发送一个对象,一个属于以下类的对象:

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!");
            }
        }

这是发送失败。 您可以通过套接字发送包含图像的对象吗?

发送东西:

ImageIO.write((RenderedImage) image, "png", output);

你知道的接收器的事情:

ImageIO.read(input);

最新更新