Note that there are some explanatory texts on larger screens.

plurals
  1. POObjectInputStream exception
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2393179/streamcorruptedexception-invalid-type-code-ac">StreamCorruptedException: invalid type code: AC</a> </p> </blockquote> <p>Hello guys I am trying to read object from the stream over the network... I am using ReadInputObject method ... and I am implementing it inside a thread to recieve the data ... here is the while loop in the thread </p> <pre><code>while((dp = (DataPackage) ois.readObject()) != null) { Ball b = new Ball(); b.setX(dp.x); b.setY(dp.y); jTextField1.setText(b.getX() + " " +b.getY()); b.paint(ob.getGraphics()); b.setVisible(true); ois.reset(); } } catch (IOException ex) { System.out.println("Error 1 is Here"); } catch (ClassNotFoundException ex) { System.out.println("Error 2 is here"); } </code></pre> <p>the problem is that the ois gets the first object and then .... it goes inside the exception and prints out this Error 1 is here </p> <p>here is the code where I send the object</p> <pre><code>DataPackage dp = new DataPackage(); dp.x=b1.getX(); dp.y=b1.getY(); dp.t=b1.getT(); dp.dx=(int)b1.getDx(); dp.dy=(int)b1.getDy(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(Server_login.client.getOutputStream()); } catch (IOException ex) { Logger.getLogger(Game_Painters_right.class.getName()).log(Level.SEVERE, null, ex); } try { oos.writeObject(dp); } catch (IOException ex) { Logger.getLogger(Game_Painters_right.class.getName()).log(Level.SEVERE, null, ex); } </code></pre> <p>what is the wrong in my code ?? thank you </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload