private boolean isEncrypted()

in src/java/org/apache/fulcrum/jce/crypto/SmartDecryptingInputStream.java [126:172]


    private boolean isEncrypted( byte[] content )
        throws IOException
    {
        if( content.length == 0 )
        {
            return false;
        }
        else if( ( content.length % 8 ) != 0 )
        {
            // the block length is 8 bytes - if the length
            // is not a multipe of 8 then the content was
            // definitely not encrypted
            return false;
        }
        else if( this.isPDF(content) )
        {
            return false;
        }
        else if( this.isXML(content) )
        {
            return false;
        }
        else if( this.isZip(content) )
        {
            return false;
        }
        else if( this.isUtf16Text(content) )
        {
            return false;
        }
        else
        {
            for( int i=0; i<content.length; i++ )
            {
                // do we have control characters in it?

                char ch = (char) content[i];

                if( this.isAsciiControl(ch) )
                {
                    return true;
                }
            }

            return false;
        }
    }