emitArrayEnd();
}
protected void marshal(Object o, boolean asMapKey, WriteCache cache) throws Exception {
WriteHandler h = getHandler(o);
boolean supported = false;
if(h != null) { // TODO: maybe remove getWriteHandler call and this check and just call tag
String t = h.tag(o);
if(t != null) {
supported = true;
if(t.length() == 1) {
switch(t.charAt(0)) {
case '_': emitNil(asMapKey, cache); break;
case 's': emitString(null, null, escape((String)h.rep(o)), asMapKey, cache); break;
case '?': emitBoolean((Boolean)h.rep(o), asMapKey, cache); break;
case 'i': emitInteger(h.rep(o), asMapKey, cache); break;
case 'd': emitDouble(h.rep(o), asMapKey, cache); break;
case 'b': emitBinary(h.rep(o), asMapKey, cache); break;
case '\'': emitTagged(t, h.rep(o), false, cache); break;
default: emitEncoded(t, h, o, asMapKey, cache); break;
}
}
else {
if(t.equals("array"))
emitArray(h.rep(o), asMapKey, cache);
else if(t.equals("map"))
emitMap(h.rep(o), asMapKey, cache);
else
emitEncoded(t, h, o, asMapKey, cache);
}
flushWriter();
}