Beispiel #1
0
        protected override byte[] doDecoding(byte[] bytes)
        {// throws DecoderException {
            if (bytes == null)
            {
                return(null);
            }
            bool hasUnderscores = false;

            for (int i = 0; i < bytes.Length; i++)
            {
                if (bytes[i] == UNDERSCORE)
                {
                    hasUnderscores = true;
                    break;
                }
            }
            if (hasUnderscores)
            {
                byte[] tmp = new byte[bytes.Length];
                for (int i = 0; i < bytes.Length; i++)
                {
                    byte b = bytes[i];
                    if (b != UNDERSCORE)
                    {
                        tmp[i] = b;
                    }
                    else
                    {
                        tmp[i] = BLANK;
                    }
                }
                return(QuotedPrintableCodec.decodeQuotedPrintable(tmp));
            }
            return(QuotedPrintableCodec.decodeQuotedPrintable(bytes));
        }
Beispiel #2
0
 protected override byte[] doEncoding(byte[] bytes)
 {
     if (bytes == null)
     {
         return(null);
     }
     byte[] data = QuotedPrintableCodec.encodeQuotedPrintable(PRINTABLE_CHARS, bytes);
     if (this.encodeBlanks)
     {
         for (int i = 0; i < data.Length; i++)
         {
             if (data[i] == BLANK)
             {
                 data[i] = UNDERSCORE;
             }
         }
     }
     return(data);
 }