示例#1
0
 protected byte[] doDecoding(byte[] bytes) throws DecoderException {
   if (bytes == null) {
     return null;
   }
   boolean hasUnderscores = false;
   for (byte b : bytes) {
     if (b == 95) {
       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 != 95) {
         tmp[i] = b;
       } else {
         tmp[i] = 32;
       }
     }
     return QuotedPrintableCodec.decodeQuotedPrintable(tmp);
   }
   return QuotedPrintableCodec.decodeQuotedPrintable(bytes);
 }
示例#2
0
 protected 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] == 32) {
         data[i] = 95;
       }
     }
   }
   return data;
 }