X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FSerialUtils.java;h=b083e3461e2b63d3c6d2a6e702d8cf60ef5d32b0;hp=6a628f3d706563f4140a33e949c39127522c7d2b;hb=4d31956549a05df6dca42d58a1150a348a58dcd1;hpb=6e56dcb679b3033fd583652c3f56bb50c2c15ad9 diff --git a/src/be/nikiroo/utils/serial/SerialUtils.java b/src/be/nikiroo/utils/serial/SerialUtils.java index 6a628f3..b083e34 100644 --- a/src/be/nikiroo/utils/serial/SerialUtils.java +++ b/src/be/nikiroo/utils/serial/SerialUtils.java @@ -69,21 +69,24 @@ public class SerialUtils { type = type.substring(0, type.length() - 2); // remove the [] write(out, type); - write(out, "\n"); + write(out, "\r"); try { for (int i = 0; true; i++) { Object item = Array.get(value, i); // encode it normally if direct value if (!SerialUtils.encode(out, item)) { try { - // TODO: use ZIP: if not? - new Exporter(out).append(item); + // TODO: bad escaping? + write(out, "B64:"); + OutputStream bout = StringUtils.base64(out, + false, false); + new Exporter(bout).append(item); } catch (NotSerializableException e) { throw new UnknownFormatConversionException(e .getMessage()); } } - write(out, "\n"); + write(out, "\r"); } } catch (ArrayIndexOutOfBoundsException e) { // Done. @@ -93,7 +96,7 @@ public class SerialUtils { @Override protected Object fromStream(InputStream in) throws IOException { NextableInputStream stream = new NextableInputStream(in, - new NextableInputStreamStep('\n')); + new NextableInputStreamStep('\r')); try { List list = new ArrayList(); @@ -128,7 +131,6 @@ public class SerialUtils { // URL: customTypes.put("java.net.URL", new CustomSerializer() { - @Override protected void toStream(OutputStream out, Object value) throws IOException {