The problem is i have 6 different values to send. They are all primative data type accept the 2 AffineTransforms so thought it would be quicker to send them in a String, then send an object.
Ill try send the values that the AffineTransforms are made up of, and construct them from the values at the other end.
If anyone gets a better idea, let me know. Thanks.
Fortunately the ObjectOutputStream can write primitive data types too. (with writeByte,writeFloat etc...)
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13
| ByteArrayOutputStream baos=new ByteArrayOutputStream(); ObjectOutputStream oos=new ObjectOutputStream(baos); oos.writeFloat(0.4f); oos.writeObject("Hello"); byte[] b=baos.toByteArray();
ObjectInputStream ois=new ObjectInputStream(new ByteArrayInputStream(b)); float f=ois.readFloat(); String s=(String)ois.readObject(); |
Although if somebody has a better solution, I would like to see.