X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FExporter.java;h=2470bde4dace9f6dd0ca73f61373991a4cbd4283;hb=53c2b6a134b08402e1daf3e4c84b9b888de9cc9c;hp=8b04111979ddaa751548d11b56f7572381cc1fe2;hpb=db31c35860081535d6e7ddc83ab4af573bb0522e;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/serial/Exporter.java b/src/be/nikiroo/utils/serial/Exporter.java deleted file mode 100644 index 8b04111..0000000 --- a/src/be/nikiroo/utils/serial/Exporter.java +++ /dev/null @@ -1,58 +0,0 @@ -package be.nikiroo.utils.serial; - -import java.io.NotSerializableException; -import java.util.HashMap; -import java.util.Map; - -import be.nikiroo.utils.StringUtils; - -/** - * A simple class to serialise objects to {@link String}. - *

- * This class does not support inner classes (it does support nested classes, - * though). - * - * @author niki - */ -public class Exporter { - private Map map; - private StringBuilder builder; - - public Exporter() { - map = new HashMap(); - builder = new StringBuilder(); - } - - public Exporter append(Object o) throws NotSerializableException { - SerialUtils.append(builder, o, map); - return this; - } - - public void clear() { - builder.setLength(0); - map.clear(); - } - - // null = auto - public String toString(Boolean zip) { - if (zip == null) { - zip = builder.length() > 128; - } - - if (zip) { - return "ZIP:" + StringUtils.zip64(builder.toString()); - } else { - return builder.toString(); - } - } - - /** - * The exported items in a serialised form. - * - * @return the items currently in this {@link Exporter}. - */ - @Override - public String toString() { - return toString(null); - } -} \ No newline at end of file