private void readObjects(DataReader in) throws IOException {
        long ofsMin = Long.MAX_VALUE;
        long ofsMax = Long.MIN_VALUE;

        SerializedFileHeader header = serialized.header();
        SerializedFileMetadata metadata = serialized.metadata();

        Map<Long, ObjectInfo> objectInfoMap = metadata.objectInfoTable().infoMap();
        Map<Integer, TypeRoot<Type>> typeTreeMap = metadata.typeTree().typeMap();
        List<SerializedObjectData> objectData = serialized.objectData();

        for (Map.Entry<Long, ObjectInfo> infoEntry : objectInfoMap.entrySet()) {
            ObjectInfo info = infoEntry.getValue();
            long id = infoEntry.getKey();
            long ofs = header.dataOffset() + info.offset();

            ofsMin = Math.min(ofsMin, ofs);
            ofsMax = Math.max(ofsMax, ofs + info.length());

            SerializedObjectData object = new SerializedObjectData(id);
            object.info(info);

            // create and read object data buffer
            ByteBuffer buf = ByteBufferUtils.allocate((int) info.length());

            in.position(ofs);
            in.readBuffer(buf);

            object.buffer(buf);

            // get type tree if possible
            TypeRoot typeRoot = typeTreeMap.get(info.typeID());
            if (typeRoot != null) {
                object.typeTree(typeRoot.nodes());
            }

            objectData.add(object);
        }

        DataBlock objectDataBlock = serialized.objectDataBlock();
        objectDataBlock.offset(ofsMin);
        objectDataBlock.endOffset(ofsMax);
        L.log(Level.FINER, "objectDataBlock: {0}", objectDataBlock);
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-core/src/main/java/info/ata4/junity/serialize/SerializedFileReader.java