public <T> T read(InputStream input, Class<T> rootType) {
        if (input == null) {
            throw new NullPointerException("input");
        }
        if (rootType == null) {
            throw new NullPointerException("rootType");
        }
        DataInputStream dataInput;
        if (input instanceof DataInputStream) {
            dataInput = (DataInputStream) input;
        } else {
            dataInput = new DataInputStream(input);
        }
        try {
            try {
                return parseVersion(dataInput, rootType);
            } finally {
                input.close();
            }
        } catch (RuntimeException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
public < T > T read ( InputStream input , Class < T > rootType ) { if ( input == null ) { throw new NullPointerException ( "input" ) ; } if ( rootType == null ) { throw new NullPointerException ( "rootType" ) ; } DataInputStream dataInput ; if ( input instanceof DataInputStream ) { dataInput = ( DataInputStream ) input ; } else { dataInput = new DataInputStream ( input ) ; } try { try { return parseVersion ( dataInput , rootType ) ; } finally { input . close ( ) ; } } catch ( RuntimeException ex ) { throw ex ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } }
Reads and parses to a bean.

@param <T>  the root type
@param input  the input stream, not null
@param rootType  the root type, not null
@return the bean, not null