1 17 18 package org.apache.james.util; 19 20 import java.io.FilterOutputStream ; 21 import java.io.IOException ; 22 import java.io.OutputStream ; 23 24 28 public class ExtraDotOutputStream extends FilterOutputStream { 29 30 39 40 43 protected int countLast0A0D; 44 45 50 public ExtraDotOutputStream(OutputStream out) { 51 super(out); 52 countLast0A0D = 2; } 54 55 64 public void write(int b) throws IOException { 65 switch (b) { 66 case '.': 67 if (countLast0A0D == 2) { 68 out.write('.'); 70 } 71 countLast0A0D = 0; 72 break; 73 case '\r': 74 if (countLast0A0D == 1) out.write('\n'); countLast0A0D = 1; 76 break; 77 case '\n': 78 83 if (countLast0A0D != 1) out.write('\r'); 84 countLast0A0D = 2; 85 break; 86 default: 87 countLast0A0D = 0; 89 break; 90 } 91 out.write(b); 92 } 93 } 94 | Popular Tags |