[jacorb-developer] CORBA Any Serialization and Deserialization
Jürgen Weber
juergen at jwi.de
Mon Mar 24 19:36:59 CET 2014
See the comment At
http://www.hascode.com/2014/03/using-apache-avro-with-java-and-maven/
Am 24.03.2014 18:52 schrieb "Chun Tat David Chu" <
beyonddc.storage at gmail.com>:
> Hi All,
>
> I am currently using JacORB 3.2. I have a requirement where I need to
> serialize a CORBA Any, write it to a file and then read it back as a CORBA
> Any.
>
> For the CORBA Any Serialization, I wrote the following code:
> org.omg.CORBA.portable.InputStream in = anyData.create_input_stream();
> byte[] byteArray = IOUtils.toByteArray(in);
> FileUtils.writeByteArrayToFile(new File(msgDestination), byteArray);
>
> When converting the byte array back to CORBA Any, I did the following:
> byte[] messageByte = FileUtils.readFileToByteArray(message);
> org.jacorb.orb.CDRInputStream inputStream =
> new org.jacorb.orb.CDRInputStream(this.orb, messageByte);
> Any anyData = inputStream.read_any();
>
> However I encountered an ArrayIndexOutOfBoundsException that is thrown by
> the read_any() method.
> java.lang.ArrayIndexOutOfBoundsException: 4
> at
> org.jacorb.orb.CDRInputStream.read_octet(CDRInputStream.java:1105)
> at org.jacorb.orb.Any.read_value(Any.java:1202)
> at org.jacorb.orb.CDRInputStream.read_any(CDRInputStream.java:667)
>
> That led me think that I probably did something wrong in the code. Can
> anyone lead me to the right path on serializing and deserializing CORBA
> Any?
>
> Thanks,
>
> David
> _______________________________________________
> jacorb-developer maillist -
> jacorb-developer at lists.spline.inf.fu-berlin.de
> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
>
More information about the jacorb-developer
mailing list