public List<Byte> serializeToByteList() throws IOException, TikaException {
        List<Byte> byteList = new ArrayList<>();

        int lengthOfItems = this.serializeItemsToByteList(byteList);

        AtomicReference<StreamObjectHeaderStart> header = new AtomicReference<>();
        if (this.streamObjectType.getIntVal() <= 0x3F && lengthOfItems <= 127) {
            header.set(new StreamObjectHeaderStart16bit(this.streamObjectType, lengthOfItems));
        } else {
            header.set(new StreamObjectHeaderStart32bit(this.streamObjectType, lengthOfItems));
        }

        byteList.addAll(0, header.get().serializeToByteList());

        if (compoundTypes.contains(this.streamObjectType)) {
            if (this.streamObjectType.getIntVal() <= 0x3F) {
                byteList.addAll(new StreamObjectHeaderEnd8bit(
                        this.streamObjectType.getIntVal()).serializeToByteList());
            } else {
                byteList.addAll(new StreamObjectHeaderEnd16bit(
                        this.streamObjectType.getIntVal()).serializeToByteList());
            }
        }

        return byteList;
    }
Serialize item to byte list.

@return The byte list.
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