static String parse(final byte content[], final Metadata metadata, final int limit) throws TikaException, IOException {
        // check that its not unprivileged code like a script
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new SpecialPermission());
        }

        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
                @Override
                public String run() throws TikaException, IOException {
                    return TIKA_INSTANCE.parseToString(StreamInput.wrap(content), metadata, limit);
                }
            });
        } catch (PrivilegedActionException e) {
            // checked exception from tika: unbox it
            Throwable cause = e.getCause();
            if (cause instanceof TikaException) {
                throw (TikaException) cause;
            } else if (cause instanceof IOException) {
                throw (IOException) cause;
            } else {
                throw new AssertionError(cause);
            }
        }
    }
static String parse ( final byte content [ ] , final Metadata metadata , final int limit ) throws TikaException , IOException { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkPermission ( new SpecialPermission ( ) ) ; } try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < String > ( ) { @ Override public String run ( ) throws TikaException , IOException { return TIKA_INSTANCE . parseToString ( StreamInput . wrap ( content ) , metadata , limit ) ; } } ) ; } catch ( PrivilegedActionException e ) { Throwable cause = e . getCause ( ) ; if ( cause instanceof TikaException ) { throw ( TikaException ) cause ; } else if ( cause instanceof IOException ) { throw ( IOException ) cause ; } else { throw new AssertionError ( cause ) ; } } }
only package private for testing!