public T read(Unpacker u, T to, boolean required) throws IOException,
            MessageTypeException {
        if (!required && u.trySkipNil()) {
            return null;
        }
        if (to == null) {
            throw new MessageTypeException("convert into unknown type is invalid");
        }
        T o = u.read(to);
        if (required && o == null) {
            throw new MessageTypeException("Unexpected nil value");
        }
        return o;
    }