X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FSerialUtils.java;h=204d1d95a0ab22418a74fd540368fa183c38c460;hb=67b76a57e0789b4c2afb0091b9d5bcd120290ed1;hp=6a628f3d706563f4140a33e949c39127522c7d2b;hpb=b5b1b9b7d7e7af46f947c5de3aeb931dbd2367d7;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/serial/SerialUtils.java b/src/be/nikiroo/utils/serial/SerialUtils.java index 6a628f3..204d1d9 100644 --- a/src/be/nikiroo/utils/serial/SerialUtils.java +++ b/src/be/nikiroo/utils/serial/SerialUtils.java @@ -19,8 +19,8 @@ import java.util.UnknownFormatConversionException; import be.nikiroo.utils.IOUtils; import be.nikiroo.utils.Image; -import be.nikiroo.utils.NextableInputStream; -import be.nikiroo.utils.NextableInputStreamStep; +import be.nikiroo.utils.streams.NextableInputStream; +import be.nikiroo.utils.streams.NextableInputStreamStep; import be.nikiroo.utils.StringUtils; /** @@ -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 {