private long getByteCount() throws SAXException {
        try {
            if (stream.hasLength()) {
                return stream.getLength();
            } else {
                return stream.getPosition();
            }
        } catch (IOException e) {
            throw new SAXException("Unable to get stream length", e);
        }
    }
Converts the given {@link SAXException} to a corresponding
{@link TikaException} if it's caused by this instance detecting
a zip bomb.

@param e SAX exception
@throws TikaException zip bomb exception
tika-core/src/main/java/org/apache/tika/sax/SecureContentHandler.java