private byte[] getSection(InputStream is, String name) {

        byte[] value = new byte[0];

        switch (name) {
            case "residual": {
                // the header shouldn't be more than 1k, but just being generous here
                int maxsize = 8192;     //  8K

                byte bstart =
                        SYN;     // check for SYN [0x16 : ctrl-v] (may have leftover residue from

                // preceding message)
                byte bfinish =
                        SOH;     // check for SOH [0x01 : ctrl-a] (typically follows a pair of SYN

                // [0x16 : ctrl-v])
                value = getSection(is, maxsize, bstart, bfinish, true);
                break;
            }
            case "header": {
                // the header shouldn't be more than 1k, but just being generous here
                int maxsize = 8192;     //  8K

                byte bstart =
                        SOH;     // check for SOH [0x01 : ctrl-a] (typically follows a pair of SYN

                // [0x16 : ctrl-v])
                byte bfinish =
                        STX;     // check for STX [0x02 : ctrl-b] (marks end of header, beginning of

                // message)
                value = getSection(is, maxsize, bstart, bfinish, true);
                break;
            }
            case "body": {
                // the message shouldn't be more than 16k (?), leaving plenty of space
                int maxsize = 524288;     //  512K

                byte bstart =
                        STX;     // check for STX [0x02 : ctrl-b] (marks end of header, beginning of

                // message)
                byte bfinish =
                        ETX;     // check for ETX [0x03 : ctrl-c] (marks end of message, beginning of

                // footer)
                value = getSection(is, maxsize, bstart, bfinish, true);
                break;
            }
            case "footer": {
                // the footer shouldn't be more than 1k , leaving plenty of space
                int maxsize = 8192;     //  8K

                byte bstart =
                        ETX;     // check for ETX [0x03 : ctrl-c] (marks end of message, beginning of

                // footer)
                byte bfinish = EOT;     // check for EOT [0x04 : ctrl-d] (marks end of transmission)

                value = getSection(is, maxsize, bstart, bfinish, true);
                break;
            }
        }

        return (value);
    }
scan the news messsage and store the metadata and data into a map
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-news-module/src/main/java/org/apache/tika/parser/iptc/IptcAnpaParser.java