< prev index next >

src/java.base/share/classes/sun/net/smtp/SmtpClient.java

Print this page




 242         }
 243     }
 244 
 245     public void write(int b) {
 246         try {
 247             // quote a dot at the beginning of a line
 248             if (lastc == '\n' && b == '.') {
 249                 out.write('.');
 250             }
 251 
 252             // translate NL to CRLF
 253             if (b == '\n' && lastc != '\r') {
 254                 out.write('\r');
 255             }
 256             out.write(b);
 257             lastc = b;
 258         } catch (IOException e) {
 259         }
 260     }
 261 
 262     public void write(byte b[], int off, int len) {
 263         try {
 264             int lc = lastc;
 265             while (--len >= 0) {
 266                 int c = b[off++];
 267 
 268                 // quote a dot at the beginning of a line
 269                 if (lc == '\n' && c == '.')
 270                     out.write('.');
 271 
 272                 // translate NL to CRLF
 273                 if (c == '\n' && lc != '\r') {
 274                     out.write('\r');
 275                 }
 276                 out.write(c);
 277                 lc = c;
 278             }
 279             lastc = lc;
 280         } catch (IOException e) {
 281         }
 282     }


 242         }
 243     }
 244 
 245     public void write(int b) {
 246         try {
 247             // quote a dot at the beginning of a line
 248             if (lastc == '\n' && b == '.') {
 249                 out.write('.');
 250             }
 251 
 252             // translate NL to CRLF
 253             if (b == '\n' && lastc != '\r') {
 254                 out.write('\r');
 255             }
 256             out.write(b);
 257             lastc = b;
 258         } catch (IOException e) {
 259         }
 260     }
 261 
 262     public void write(byte[] b, int off, int len) {
 263         try {
 264             int lc = lastc;
 265             while (--len >= 0) {
 266                 int c = b[off++];
 267 
 268                 // quote a dot at the beginning of a line
 269                 if (lc == '\n' && c == '.')
 270                     out.write('.');
 271 
 272                 // translate NL to CRLF
 273                 if (c == '\n' && lc != '\r') {
 274                     out.write('\r');
 275                 }
 276                 out.write(c);
 277                 lc = c;
 278             }
 279             lastc = lc;
 280         } catch (IOException e) {
 281         }
 282     }
< prev index next >