1 21 22 27 28 package com.sun.mail.smtp; 29 30 import java.io.*; 31 import com.sun.mail.util.CRLFOutputStream; 32 33 42 public class SMTPOutputStream extends CRLFOutputStream { 43 public SMTPOutputStream(OutputStream os) { 44 super(os); 45 } 46 47 public void write(int b) throws IOException { 48 if ((lastb == '\n' || lastb == '\r' || lastb == -1) && b == '.') { 51 out.write('.'); 52 } 53 54 super.write(b); 55 } 56 57 60 public void write(byte b[], int off, int len) throws IOException { 61 int lastc = (lastb == -1) ? '\n' : lastb; 62 int start = off; 63 64 len += off; 65 for (int i = off; i < len; i++) { 66 if ((lastc == '\n' || lastc == '\r') && b[i] == '.') { 67 super.write(b, start, i - start); 68 out.write('.'); 69 start = i; 70 } 71 lastc = b[i]; 72 } 73 if ((len - start) > 0) 74 super.write(b, start, len - start); 75 } 76 77 89 public void flush() { 90 } 92 } 93 | Popular Tags |