X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2FExporter.java;h=6325484eda7ae32ba3a1ebd9055ab8849d8deacd;hb=088c1d7a37212c54251438841995aeb8e5b26fad;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 index 8b04111..6325484 100644 --- a/src/be/nikiroo/utils/serial/Exporter.java +++ b/src/be/nikiroo/utils/serial/Exporter.java @@ -1,11 +1,11 @@ package be.nikiroo.utils.serial; +import java.io.IOException; import java.io.NotSerializableException; +import java.io.OutputStream; import java.util.HashMap; import java.util.Map; -import be.nikiroo.utils.StringUtils; - /** * A simple class to serialise objects to {@link String}. *
@@ -16,43 +16,42 @@ import be.nikiroo.utils.StringUtils;
*/
public class Exporter {
private Map
+ * 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)
*
- * @return the items currently in this {@link Exporter}.
+ * @throws NotSerializableException
+ * if the object cannot be serialised (in this case, the
+ * {@link Exporter} can contain bad, most probably not
+ * importable data)
+ * @throws IOException
+ * in case of I/O error
*/
- @Override
- public String toString() {
- return toString(null);
+ public Exporter append(Object o) throws NotSerializableException,
+ IOException {
+ SerialUtils.append(out, o, map);
+ return this;
}
}
\ No newline at end of file