/** * Creates writer to write to the output stream. Upon creation writer is alwais in tree mode. * * @param outputStream See {@link #setStreamMode()} */ public Writer(OutputStream outputStream) { this(outputStream, BossBiMapper.newSerializer()); }
/** * Try to serialize object to {@link Binder} using current set of {@link BiAdapter}. See {@link * #registerAdapter(Class, BiAdapter)} for more. * * @param x object to serialize (can be array, list, map, binder or any object with registered adapter. processes * in depth, e.g. all values in the map or items in the list. * @param <T> * * @return either a Binder or a simple object x (e.g. String if x instanceof String). * * @throws IllegalArgumentException if unkonwn ibject ecnountered which can not be serialized. */ public static @NonNull <T> T serialize(Object x) { return newSerializer().serialize(x); }