Code example for ObjectInputStream

Methods: close, readObject

0
        Object obj = null;
        ByteArrayInputStream bais = null;
        ObjectInputStream ois = null;
        try { 
            bais = new ByteArrayInputStream(objContent);
            ois = new ObjectInputStream(bais);
            obj = ois.readObject();
        } 
        catch (final IOException ex) {
            throw ex;
        } 
        catch (final ClassNotFoundException ex) {
            this.logger.warn("Failed to decode object.", ex);
        } 
        finally { 
            if (ois != null) {
                try { 
                    ois.close();
                    bais.close();
                } 
                catch (final IOException ex) {
                    this.logger.error("Failed to close stream.", ex);
                }