Convert the contents of an InputStream to an object of a given class.

@param cl Type of object
@param s InputStream to be read
@return Object of the given type
967011
public static <T> T unmarshal(Class<T> cl, InputStream s) throws JAXBException {
    return unmarshal(cl, new StreamSource(s));
  }
868755
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
        ObjectInputStream.GetField getField = s.readFields();

        version = getField.get("version", 1);
        resourceAdapterKey = (String) getField.get("resourceAdapterKey", null);
    }
261588
private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException {
        // Note: This must be changed if any additional fields are defined
        Object a = s.readFields().get("array", null);
        if (a == null || !a.getClass().isArray())
            throw new java.io.InvalidObjectException("Not array type");
        if (a.getClass() != Object[].class)
            a = Arrays.copyOf((Object[])a, Array.getLength(a), Object[].class);
        U.putObjectVolatile(this, ARRAY, a);
    }
565421
static Object decode(String s) {
    byte[] bytes = Base64.base64ToByteArray(s);
    ObjectInputStream objectInputStream;
    try {
      objectInputStream = new ObjectInputStream(
          new ByteArrayInputStream(bytes));
      return objectInputStream.readObject();
    } catch (IOException | ClassNotFoundException e) {
      log.error(e);
      return null;
    }
  }
28599
public static ClassLoader getClassLoader(Class<?> cls) {
        ClassLoader cl = cls.getClassLoader();
        if (cl == null) {
            cl = getClassLoader();
        }
        return cl;
    }
221600
@SuppressWarnings("unchecked")
    public final Object createInstance(final SgClass clasz) {

        final Class newClass = createClass(clasz);
        return createInstance(newClass, new Class[] {}, new Object[] {});

    }
694500
private void readObject(ObjectInputStream s)
        throws IOException, ClassNotFoundException
    {
        s.defaultReadObject();
        Throwable cause = super.getCause();
        if (!(cause instanceof IOException))
            throw new InvalidObjectException("Cause must be an IOException");
    }
250411
@SuppressWarnings("rawtypes")
	public static Object toObject(File file, String encoding, Class<Map> cls) throws UnmarshalException, NoSuchPathException {
		
		if (file == null || !file.exists()) {
			throw new NoSuchPathException("Could not find file");
		} 
		if (file.isDirectory()) {
			throw new NoSuchPathException(String.format("%s is Directory", file.getAbsolutePath()));
		}
		
		Object object = null;
		
		Unmarshaller bind = new XmlUnmarshaller(new ResourceReader().getFileStream(file, encoding));
		bind.setRootClass(cls);
		object = bind.unmarshal();


		return object;
	}
159427
public static <T> T unmarshal(Class<T> cl, Source s) throws JAXBException {
    JAXBContext ctx = JAXBContext.newInstance(cl);
    Unmarshaller u = ctx.createUnmarshaller();
    return u.unmarshal(s, cl).getValue();
  }
435936
public Swagger read(Class<?> cls) {
        SwaggerDefinition swaggerDefinition = cls.getAnnotation(SwaggerDefinition.class);
        if (swaggerDefinition != null) {
            readSwaggerConfig(cls, swaggerDefinition);
        }

        return read(cls, "", null, false, new String[0], new String[0], new LinkedHashMap<>(), new ArrayList<>(), new HashSet<>());
    }
636473
public Object readObject(Class cl)
        throws IOException
    {
        if (cl == null || cl == Object.class)
            return readObject();

        int tag = read();

        switch (tag) {
            case 'N':
                return null;

            case 'M': {
                String type = readType();

                // hessian/3386
                if ("".equals(type)) {
                    Deserializer reader;
                    reader = _serializerFactory.getDeserializer(cl);

                    return reader.readMap(this);
                }
                else {
                    Deserializer reader;
                    reader = _serializerFactory.getObjectDeserializer(type);

                    return reader.readMap(this);
                }
            }

            case 'V': {
                String type = readType();
                int length = readLength();

                Deserializer reader;
                reader = _serializerFactory.getObjectDeserializer(type);

                if (cl != reader.getType() && cl.isAssignableFrom(reader.getType()))
                    return reader.readList(this, length);

                reader = _serializerFactory.getDeserializer(cl);

                Object v = reader.readList(this, length);

                return v;
            }

            case 'R': {
                int ref = parseInt();

                return _refs.get(ref);
            }

            case 'r': {
                String type = readType();
                String url = readString();

                return resolveRemote(type, url);
            }
        }

        _peek = tag;

        // hessian/332i vs hessian/3406
        //return readObject();

        Object value = _serializerFactory.getDeserializer(cl).readObject(this);

        return value;
    }
346917
private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException {
        s.defaultReadObject();
        Object ex = s.readObject();
        if (ex != null)
            setExceptionalCompletion((Throwable)ex);
    }
124869
public static <T> T unmarshal(Class<T> cl, String s) throws JAXBException {
    return unmarshal(cl, new StringReader(s));
  }
990524
public Object fromStream(final byte[] iStream) throws IOException {
		if (iStream == null || iStream.length == 0)
			// NULL VALUE
			return null;

		final int classNameSize = OBinaryProtocol.bytes2int(iStream);
		if (classNameSize <= 0)
			OLogManager.instance().error(this, "Class signature not found in ANY element: " + Arrays.toString(iStream),
					OSerializationException.class);

		final String className = OBinaryProtocol.bytes2string(iStream, 4, classNameSize);

		try {
			final OSerializableStream stream;
			// CHECK FOR ALIASES
			if (className.equalsIgnoreCase("q"))
				// QUERY
				stream = new OSQLSynchQuery<Object>();
			else if (className.equalsIgnoreCase("c"))
				// SQL COMMAND
				stream = new OCommandSQL();
			else if (className.equalsIgnoreCase("s"))
				// SCRIPT COMMAND
				stream = new OCommandScript();
			else
				// CREATE THE OBJECT BY INVOKING THE EMPTY CONSTRUCTOR
				stream = (OSerializableStream) Class.forName(className).newInstance();

			return stream.fromStream(OArrays.copyOfRange(iStream, 4 + classNameSize, iStream.length));

		} catch (Exception e) {
			OLogManager.instance().error(this, "Error on unmarshalling content. Class: " + className, e, OSerializationException.class);
		}
		return null;
	}
607779
ClassFields get(final Class<?> cls) {
        ClassFields classFields = classToClassFields.get(cls);
        if (classFields == null) {
            classToClassFields.put(cls,
                    classFields = new ClassFields(cls, resolveTypes, onlySerializePublicFields, this));
        }
        return classFields;
    }
1165633
static public Object deserialize(InputStream in, Class<?> cls)
		throws IOException
	{
		if (cls==null)
			throw new NullPointerException("cls");
		
		Object obj = deserialize(in);
		if (!cls.isInstance(obj))
		{
			throw new InvalidObjectException("type of deserialized instance not of required class.");
		}
		
		return obj;
	}
732571
public <T> T readObject(Class<T> cls) {
    return kryo.readObject(input, cls);
  }