public Object getPrimitiveValue() throws IOException
    {
        if ("int".equals(type))
        {
            Number integer = (Number) get("value");
            return integer.intValue();
        }
        if ("long".equals(type))
        {
            return get("value");
        }
        if ("boolean".equals(type))
        {
            return get("value");
        }
        if ("byte".equals(type))
        {
            Number b = (Number) get("value");
            return b.byteValue();
        }
        if ("double".equals(type))
        {
            return get("value");
        }
        if ("float".equals(type))
        {
            Number f = (Number) get("value");
            return f.floatValue();
        }
        if ("short".equals(type))
        {
            Number s = (Number) get("value");
            return s.shortValue();
        }
        if ("char".equals(type))
        {
            String s = (String) get("value");
            return s.charAt(0);
        }
        throw new IOException("Invalid primitive type, pos = " + pos);
    }