public static StreamObject parseStreamObject(StreamObjectHeaderStart header, byte[] byteArray,
                                                 AtomicInteger index) throws IOException, TikaException {
        if (streamObjectTypeMapping.containsKey(header.type)) {
            Class headerTypeClass = streamObjectTypeMapping.get(header.type);
            StreamObject streamObject;
            try {
                streamObject =
                        (StreamObject) headerTypeClass.getDeclaredConstructor().newInstance();
            } catch (InstantiationException | IllegalAccessException | NoSuchMethodException |
                     InvocationTargetException e) {
                throw new TikaException("Could not instantiate class " + headerTypeClass, e);
            }

            int res = streamObject.deserializeFromByteArray(header, byteArray, index.get());
            index.addAndGet(res);

            return streamObject;
        }

        int tmpIndex = index.get();
        tmpIndex -=
                header.headerType == StreamObjectHeaderStart.STREAM_OBJECT_HEADER_START_16_BIT ? 2 : 4;
        throw new StreamObjectParseErrorException(tmpIndex, "Unknown", String.format(Locale.US,
                "Failed to create the specified stream object instance, the type %s of stream object " +
                        "header in the current index is not defined", header.type.getIntVal()),
                null);
    }
Parse stream object from byte array.

@param header    The instance of StreamObjectHeaderStart.
@param byteArray The byte array.
@param index     The position where to start.
@return The instance of StreamObject.
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/onenote/fsshttpb/streamobj/StreamObject.java