X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FExporter.java;h=90939880f6f29e0e2ba1488f274db1daed932f7b;hp=8b522e9556054dea43572f6a5e4226f738e116b8;hb=f157aed840bdd5b8ef04902d2326d916f71139da;hpb=08a58812f12617289463b00161c98d7c59490bf2 diff --git a/src/be/nikiroo/utils/serial/Exporter.java b/src/be/nikiroo/utils/serial/Exporter.java index 8b522e9..9093988 100644 --- a/src/be/nikiroo/utils/serial/Exporter.java +++ b/src/be/nikiroo/utils/serial/Exporter.java @@ -18,22 +18,52 @@ public class Exporter { private Map map; private StringBuilder builder; + /** + * Create a new {@link Exporter}. + */ public Exporter() { map = new HashMap(); builder = new StringBuilder(); } + /** + * Serialise the given object and add it to the list. + *

+ * Important: If the operation fails (with a + * {@link NotSerializableException}), the {@link Exporter} will be corrupted + * (will contain bad, most probably not importable data). + * + * @param o + * the object to serialise + * @return this (for easier appending of multiple values) + * + * @throws NotSerializableException + * if the object cannot be serialised (in this case, the + * {@link Exporter} can contain bad, most probably not + * importable data) + */ public Exporter append(Object o) throws NotSerializableException { SerialUtils.append(builder, o, map); return this; } + /** + * Clear the current content. + */ public void clear() { builder.setLength(0); map.clear(); } - // null = auto + /** + * The exported items in a serialised form. + * + * @param zip + * TRUE to have zipped content, FALSE to have raw content, NULL + * to let the system decide + * + * @return the items currently in this {@link Exporter} + */ public String toString(Boolean zip) { if (zip == null) { zip = builder.length() > 128; @@ -47,9 +77,9 @@ public class Exporter { } /** - * The exported items in a serialised form. + * The exported items in a serialised form (possibly zipped). * - * @return the items currently in this {@link Exporter}. + * @return the items currently in this {@link Exporter} */ @Override public String toString() {