jenetics / jpx

JPX - Java GPX library
Apache License 2.0
206 stars 31 forks source link

Convert gpx to string #61

Closed giloutho closed 6 years ago

giloutho commented 6 years ago

Many thanks for this nice library.

When the GPX object is created, I want it as a string. I read javadoc, but I was unable to use GPX.Writer with method toString. Can you put a snippet ?

Additional question : for writing the GPX object to a file, I use GPX.write. I have no line breaks in the file. What is the correct way ?

jenetics commented 6 years ago

You can do it this way:

final GPX gpx = ...;
System.out.println(GPX.writer("    ").toString(gpx));
giloutho commented 6 years ago

Many thanks... It's perfect now