/** * Switch the last remembered type to match the type of the given object. * * @param obj the object * @return the auto-detected type used */ StorageDataTypeBase switchType(Object obj) { int typeId = getTypeId(obj); StorageDataTypeBase l = last; if (typeId != l.getType()) { last = l = newType(typeId); } return l; }
@Override public Object read(ByteBuffer buff) { int tag = buff.get(); int typeId = StorageDataType.getTypeId(tag); StorageDataTypeBase t = last; if (typeId != t.getType()) { last = t = newType(typeId); } return t.read(buff, tag); }