private boolean isUtf16Text()

in src/java/org/apache/fulcrum/jce/crypto/SmartDecryptingInputStream.java [252:272]


    private boolean isUtf16Text( byte[] content ) throws IOException
    {
        if( content.length < 2 )
        {
            return false;
        }

        if( this.hasByteOrderMark( content ) )
        {
            // we should have plenty of 0x00 in a text file

            int estimate = (content.length-2)/3;

            if( this.count(content,(byte)0) > estimate )
            {
                return true;
            }
        }

        return false;
    }