Java InputStream Deserialize to Object deserialize(InputStream in)

Here you can find the source of deserialize(InputStream in)

Description

Deserialize from input stream

License

Open Source License

Parameter

Parameter Description
in Where to read serialized object from

Exception

Parameter Description
IOException Reading from input stream
ClassNotFoundException Should not be thrown as only casting to Object

Return

Deserialized object

Declaration

public static Object deserialize(InputStream in) throws IOException, ClassNotFoundException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;

public class Main {
    /**//from w  ww.ja  v a  2s. c  o m
     * Deserialize from input stream
     * 
     * @param in
     *          Where to read serialized object from
     * @return Deserialized object
     * @throws IOException
     *           Reading from input stream
     * @throws ClassNotFoundException
     *           Should not be thrown as only casting to Object
     */
    public static Object deserialize(InputStream in) throws IOException, ClassNotFoundException {
        ObjectInputStream is = new ObjectInputStream(in);
        return is.readObject();
    }
}

Related

  1. deserialize(InputStream in)
  2. deserialize(InputStream in, Class cls)
  3. deserialize(InputStream inputStream)
  4. deserialize(InputStream inputStream)
  5. deserialize(InputStream inputStream)