NDM object from strings

Hi Orekit community,

I was wondering if there is a way to create an Ndm object such as Opm or Cdm from a String?
So without reading a file.

Best,
Romain.

Yes, but beware, some Java is involved!
CCSDS parsing is based on an Orekit interface called DataSource, which acts as a proxy to underlying binary streams or character readers and delays opening of the channel until it is really needed. The delaying property is of no use in your case, since you already have the string, but you must anyway provide a way to open a reader on your string. The following should work:

  String message = getTheStringMessage();
  DataSource ds  = new DataSource("some-name-for-my-message",
                                  () -> new StringReader(message));
  Opm opm        = new ParserBuilder().parseMessage(ds);

Dear Luc,

thank you! I see that this involves Java’s lambda expression. I think you can guess my next question :sweat_smile:: how to replicate that with the Python wrapper???

Cheers,
Romain.

Anybody out there to figure this one out?
Or better, could this constructor of DataSource be added to the Java code?

Romain.