From cd3d510fdeb0ad53ae39e1fda34acf328c70c345 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Wed, 29 May 2019 22:13:34 +0200 Subject: [PATCH] jdoc --- src/be/nikiroo/utils/serial/SerialUtils.java | 19 +------------------ .../utils/serial/server/ServerBridge.java | 1 - 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/be/nikiroo/utils/serial/SerialUtils.java b/src/be/nikiroo/utils/serial/SerialUtils.java index c4b7cf9..5a20215 100644 --- a/src/be/nikiroo/utils/serial/SerialUtils.java +++ b/src/be/nikiroo/utils/serial/SerialUtils.java @@ -65,8 +65,6 @@ public class SerialUtils { 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 ? String type = value.getClass().getCanonicalName(); type = type.substring(0, type.length() - 2); // remove the [] @@ -79,11 +77,11 @@ public class SerialUtils { write(out, "\r"); if (!SerialUtils.encode(out, item)) { try { - // TODO: bad escaping? write(out, "B64:"); OutputStream out64 = new Base64OutputStream( out, true); new Exporter(out64).append(item); + out64.flush(); } catch (NotSerializableException e) { throw new UnknownFormatConversionException(e .getMessage()); @@ -464,7 +462,6 @@ public class SerialUtils { } } - // TODO: Not efficient for (String prefix : new String[] { "c\"", "\"", "b", "s", "i", "l", "f", "d", "E:" }) { if (encodedValue.startsWith(prefix)) { @@ -676,20 +673,6 @@ public class SerialUtils { out.write('\"'); } - // aa bb -> "aa\tbb" - static void encodeString(OutputStream out, InputStream raw) - throws IOException { - out.write('\"'); - byte buffer[] = new byte[4096]; - for (int len = 0; (len = raw.read(buffer)) > 0;) { - for (int i = 0; i < len; i++) { - // TODO: not 100% correct, look up howto for UTF-8 - encodeString(out, (char) buffer[i]); - } - } - out.write('\"'); - } - // for encoding string, NOT to encode a char by itself! static void encodeString(OutputStream out, char raw) throws IOException { switch (raw) { diff --git a/src/be/nikiroo/utils/serial/server/ServerBridge.java b/src/be/nikiroo/utils/serial/server/ServerBridge.java index b976996..0b734c6 100644 --- a/src/be/nikiroo/utils/serial/server/ServerBridge.java +++ b/src/be/nikiroo/utils/serial/server/ServerBridge.java @@ -226,7 +226,6 @@ public class ServerBridge extends Server { * the data to trace */ private void trace(String prefix, String data) { - // TODO: we convert to string and back int size = data == null ? 0 : data.length(); String ssize = StringUtils.formatNumber(size) + "bytes"; -- 2.27.0