public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {

        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();
        byte[] asciiNameBytes = new byte[ASCII_CHUNK_LENGTH];
        IOUtils.readFully(stream, asciiNameBytes);
        int asciiNameLength =
                (int) asciiNameBytes[0];//don't need to convert to unsigned int because it can't
        // be that long
        //bounds check name length
        if (asciiNameLength < 0) {
            throw new TikaException("ascii name length must be >= 0");
        } else if (asciiNameLength > ASCII_CHUNK_LENGTH) {
            throw new TikaException("ascii name length must be < 55");
        }

        String asciiName =
                new String(asciiNameBytes, 1, asciiNameLength, StandardCharsets.US_ASCII);
        metadata.set(TikaCoreProperties.MODIFIER, asciiName);

        int unicodeCharLength = stream.read();
        if (asciiNameLength == unicodeCharLength) {
            stream.read();//zero after the char length
            //this is effectively bounds checked by asciiNameLength
            byte[] unicodeBytes = new byte[unicodeCharLength * 2];
            IOUtils.readFully(stream, unicodeBytes);
            String unicodeName = new String(unicodeBytes, StandardCharsets.UTF_16LE);
            metadata.set(TikaCoreProperties.MODIFIER, unicodeName);
        } else {
            throw new TikaException("Ascii name length should be the same as the unicode length");
        }
        xhtml.endDocument();
    }
Extracts owner from MS temp file
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/MSOwnerFileParser.java