Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can i convert object to byte array very*100 fast?

843829May 18 2009 — edited May 19 2009
i need to transfer a object by datagram packet in embeded system.

i make a code fallowing sequence.

1) convert object to byte array ( i append object attribute to byte[] sequencailly )
2) send the byte array by datagram packet ( by JNI )

but, it's not satisfied my requirement.

it must be finished in 1ms.

but, converting is spending 2ms.

network speed is not bottleneck. ( transfer time is 0.3ms and packet size is 4096 bytes )

Using ObjectOutputStream is very slow, so i'm using this way.

is there antoher way? or how can i improve?

Edited by: JongpilKim on May 17, 2009 10:48 PM

Edited by: JongpilKim on May 17, 2009 10:51 PM

Edited by: JongpilKim on May 17, 2009 10:53 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2009
Added on May 18 2009
6 comments
856 views