1 19 package gnu.mail.util; 20 21 import java.io.*; 22 23 34 public class RFC2822OutputStream 35 extends FilterOutputStream 36 { 37 38 39 public final static int CR = 13; 40 41 42 public final static int LF = 10; 43 44 45 public final static int MaxLineLength = 998; 46 47 48 protected int count; 49 50 51 57 public RFC2822OutputStream(CRLFOutputStream out) 58 { 59 super(out); 60 count = 0; 61 } 62 63 64 70 public void write(int ch) 71 throws IOException 72 { 73 if (ch == CR || ch == LF) { 74 out.write(ch); 75 count = 0; 76 } 77 else { 78 if (count > MaxLineLength) { 79 out.write(CR); 80 out.write(LF); 81 count = 0; 82 } 83 out.write(ch); 84 count++; 85 } 86 } 87 88 } 89 90 | Popular Tags |