private int nextType(int expectedType1, int expectedType2) {
        int type = nextType();
        if (type == expectedType1 || type == expectedType2 || type == TYPE_NULL)
            return type;

        throw new ConversionException("Expected a " + classForHandle(expectedType1) + " but value is a "
                + classForHandle(type));
    }