private void readHierarchy(Object object, ObjectStreamClass classDesc)
            throws IOException, ClassNotFoundException, NotActiveException {
        if (object == null && mustResolve) {
            throw new NotActiveException();
        }

        List<ObjectStreamClass> streamClassList = classDesc.getHierarchy();
        if (object == null) {
            for (ObjectStreamClass objectStreamClass : streamClassList) {
                readObjectForClass(null, objectStreamClass);
            }
        } else {
            List<Class<?>> superclasses = cachedSuperclasses.get(object.getClass());
            if (superclasses == null) {
                superclasses = cacheSuperclassesFor(object.getClass());
            }

            int lastIndex = 0;
            for (int i = 0, end = superclasses.size(); i < end; ++i) {
                Class<?> superclass = superclasses.get(i);
                int index = findStreamSuperclass(superclass, streamClassList, lastIndex);
                if (index == -1) {
                    readObjectNoData(object, superclass,
                            ObjectStreamClass.lookupStreamClass(superclass));
                } else {
                    for (int j = lastIndex; j <= index; j++) {
                        readObjectForClass(object, streamClassList.get(j));
                    }
                    lastIndex = index + 1;
                }
            }
        }
    }
private void readHierarchy ( Object object , ObjectStreamClass classDesc ) throws IOException , ClassNotFoundException , NotActiveException { if ( object == null && mustResolve ) { throw new NotActiveException ( ) ; } List < ObjectStreamClass > streamClassList = classDesc . getHierarchy ( ) ; if ( object == null ) { for ( ObjectStreamClass objectStreamClass : streamClassList ) { readObjectForClass ( null , objectStreamClass ) ; } } else { List < Class < ? > > superclasses = cachedSuperclasses . get ( object . getClass ( ) ) ; if ( superclasses == null ) { superclasses = cacheSuperclassesFor ( object . getClass ( ) ) ; } int lastIndex = 0 ; for ( int i = 0 , end = superclasses . size ( ) ; i < end ; ++ i ) { Class < ? > superclass = superclasses . get ( i ) ; int index = findStreamSuperclass ( superclass , streamClassList , lastIndex ) ; if ( index == - 1 ) { readObjectNoData ( object , superclass , ObjectStreamClass . lookupStreamClass ( superclass ) ) ; } else { for ( int j = lastIndex ; j <= index ; j ++ ) { readObjectForClass ( object , streamClassList . get ( j ) ) ; } lastIndex = index + 1 ; } } } }
Walks the hierarchy of classes described by class descriptor
{@code classDesc} and reads the field values corresponding to
fields declared by the corresponding class descriptor. The instance to
store field values into is {@code object}. If the class
(corresponding to class descriptor {@code classDesc}) defines
private instance method {@code readObject} it will be used to load
field values.

@param object
Instance into which stored field values loaded.
@param classDesc
A class descriptor (an {@code ObjectStreamClass})
defining which fields should be loaded.

@throws IOException
If an IO exception happened when reading the field values in
the hierarchy.
@throws ClassNotFoundException
If a class for one of the field types could not be found
@throws NotActiveException
If {@code defaultReadObject} is called from the wrong
context.

@see #defaultReadObject
@see #readObject()