return sparsePacker.getResult();
}
protected void recursiveWrite(Value value) throws IOException {
if (value.isMapValue()) {
MapValue map = value.asMapValue();
int newLength = 0;
for (Map.Entry<Value, Value> entry : map.entrySet()) {
if (!entry.getValue().isNilValue()) {
++newLength;
}
}
sparsePacker.writeMapBegin(newLength);
for (Map.Entry<Value, Value> entry : map.entrySet()) {
if (!entry.getValue().isNilValue()) {
sparsePacker.write(entry.getKey());
recursiveWrite(entry.getValue());
}
}