X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FSerialUtils.java;h=55d1f842e2597381d52984c48dbd614fc3518a90;hb=3b4319db57971bce3afd9092a0f9db9809d47ca2;hp=b083e3461e2b63d3c6d2a6e702d8cf60ef5d32b0;hpb=4d31956549a05df6dca42d58a1150a348a58dcd1;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/serial/SerialUtils.java b/src/be/nikiroo/utils/serial/SerialUtils.java index b083e34..55d1f84 100644 --- a/src/be/nikiroo/utils/serial/SerialUtils.java +++ b/src/be/nikiroo/utils/serial/SerialUtils.java @@ -19,9 +19,9 @@ 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.StringUtils; +import be.nikiroo.utils.streams.NextableInputStream; +import be.nikiroo.utils.streams.NextableInputStreamStep; /** * Small class to help with serialisation. @@ -63,8 +63,9 @@ public class SerialUtils { @Override protected void toStream(OutputStream out, Object value) throws IOException { - // TODO: we use \n to separate, and b64 to un-\n -- but we could - // use \\n ? + + // TODO: we use \n to separate, and b64 to un-\n + // -- but we could use \\n ? String type = value.getClass().getCanonicalName(); type = type.substring(0, type.length() - 2); // remove the [] @@ -403,9 +404,9 @@ public class SerialUtils { } else if (value.getClass().getSimpleName().endsWith("[]")) { // Simple name does support [] suffix and do not return NULL for // inner anonymous classes - return customTypes.get("[]").encode(out, value); + customTypes.get("[]").encode(out, value); } else if (customTypes.containsKey(value.getClass().getCanonicalName())) { - return customTypes.get(value.getClass().getCanonicalName())// + customTypes.get(value.getClass().getCanonicalName())// .encode(out, value); } else if (value instanceof String) { encodeString(out, (String) value); @@ -604,6 +605,7 @@ public class SerialUtils { // aa bb -> "aa\tbb" static void encodeString(OutputStream out, String raw) throws IOException { + // TODO: not. efficient. out.write('\"'); // TODO !! utf-8 required for (char car : raw.toCharArray()) {