Expand my Community achievements bar.

Remoting Java Externalizable long

Avatar

Level 1
Hi there.



I have the following problem:



I like to use Remoting with my own externalize implementation
between a java and a as3 class.

Everthing works fine except the transmission of a member of
type long in the jave class.



The only combination which works without runtime erros is:

Write: Java: writeLong AS3: writeDouble

Read: Java: readLong AS3: reabDouble



But the values i get for the member are not correct on both
sides.

Java long value: 2 AS3 Number value: 1.9762625833649862e-323

2 Replies

Avatar

Level 2
can you post the code of how you serialized between java and
as3?

Avatar

Level 1
Java:

public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException

{

id = (String)in.readObject();

name = (String)in.readObject();

description = (String)in.readObject();

price = in.readLong();

}



public void writeExternal(ObjectOutput out) throws
IOException

{

out.writeObject(id);

out.writeObject(name);

out.writeObject(description);

out.writeLong(price);

}



AS3:

public function readExternal(input:IDataInput):void

{

id = input.readObject() as String;

name = input.readObject() as String;

description = input.readObject() as String;

price = input.readDouble();

}



public function writeExternal(output:IDataOutput):void

{

output.writeObject(id);

output.writeObject(name);

output.writeObject(description);

output.writeDouble(price);

}