The Java API documentation for read_untyped is:
void read_untyped (List received_data, SampleInfoSeq info_seq, int max_samples, int sample_states, int view_states, int instance_states)
What is the approprate type to use for the received_data parameter ?
List<T> dataSeq = new ArrayList<>(); does not work. It throws this exception. The list has an initial length of 0, but
so does any FooSeq.
Exception in thread "main" java.lang.IllegalStateException: expected sequence of length 1642; found 0
at com.rti.dds.subscription.DataReaderDelegateImpl.pull_data_sequence_from_native(Unknown Source)
at com.rti.dds.subscription.DataReaderImpl.read_or_take_untypedI(Unknown Source)
at com.rti.dds.subscription.DataReaderImpl.read_or_take_untypedI(Unknown Source)
at com.rti.dds.subscription.DataReaderImpl.read_untyped(Unknown Source)
at com.joy.fb20.da.ddsaccess.DaAIGeneric.read_io(DaAIGeneric.java:311)
at com.joy.fb20.da.main.DaTestClass.testSoFar3(DaTestClass.java:335)
at com.joy.fb20.da.main.DaTestClass.main(DaTestClass.java:66)
Thanks
Nico.
I know this is from 2014, but was there any resolution to this? I am having the same problem.
Hi gmaayan, Nico,
It should be a list of the type associated to the DataReader (it's registered type to be specific).
Thanks,
Ken
I'm still not exactly sure what's going wrong here, but what fixed it for me was using:
LoanableSequence _dataSeq = new LoanableSequence(Class.class);
for the received data instead of something like
List<MsgT> _dataSeq = new ArrayList<>();
Hi Ken,
The problem here happens when you're trying to use generics. If you can just use "FooSeq" then you're golden.
Hi gmaayan,
I did do a little experiment years ago related to this question (see attached). I'm not sure if it is helpful but it does attempt to support a somewhat generic data reader in Java.
Thanks,
Ken