本文整理汇总了Java中com.icegreen.greenmail.util.InternetPrintWriter类的典型用法代码示例。如果您正苦于以下问题:Java InternetPrintWriter类的具体用法?Java InternetPrintWriter怎么用?Java InternetPrintWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternetPrintWriter类属于com.icegreen.greenmail.util包,在下文中一共展示了InternetPrintWriter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readDotTerminatedContent
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
/**
* Reads the contents of the stream until
* <CRLF>.<CRLF> is encountered.
* <p/>
* <p/>
* It would be possible and prehaps desirable to prevent the
* adding of an unnecessary CRLF at the end of the message, but
* it hardly seems worth 30 seconds of effort.
* </p>
*/
public void readDotTerminatedContent(BufferedReader in)
throws IOException {
_content = _workspace.getTmpFile();
Writer data = _content.getWriter();
PrintWriter dataWriter = new InternetPrintWriter(data);
while (true) {
String line = in.readLine();
if (line == null)
throw new EOFException("Did not receive <CRLF>.<CRLF>");
if (".".equals(line)) {
dataWriter.close();
break;
} else {
dataWriter.println(line);
}
}
try {
message = GreenMailUtil.newMimeMessage(_content.getAsString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: SmtpConnection
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
public SmtpConnection(SmtpHandler handler, Socket sock)
throws IOException {
this.sock = sock;
sock.setSoTimeout(TIMEOUT_MILLIS);
clientAddress = sock.getInetAddress();
OutputStream o = sock.getOutputStream();
InputStream i = sock.getInputStream();
out = new InternetPrintWriter(o, true);
in = new BufferedReader(new InputStreamReader(i));
this.handler = handler;
}
示例3: ImapResponse
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
public ImapResponse(OutputStream output) {
try {
this.writer = new InternetPrintWriter(new OutputStreamWriter(output, ImapConstants.EIGHT_BIT_ENCODING), true);
} catch (UnsupportedEncodingException e) {
this.writer = new InternetPrintWriter(new OutputStreamWriter(output), true);
}
this.stringBuffer = new StringBuffer();
}
示例4: configureStreams
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
private void configureStreams()
throws IOException {
OutputStream o = _socket.getOutputStream();
InputStream i = _socket.getInputStream();
_out = new InternetPrintWriter(o, true);
_in = new BufferedReader(new InputStreamReader(i));
}
示例5: SmtpConnection
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
public SmtpConnection(SmtpHandler handler, Socket sock)
throws IOException {
this.sock = sock;
sock.setSoTimeout(TIMEOUT_MILLIS);
clientAddress = sock.getInetAddress();
OutputStream o = sock.getOutputStream();
InputStream i = sock.getInputStream();
out = InternetPrintWriter.createForEncoding(o, true, EncodingUtil.CHARSET_EIGHT_BIT_ENCODING);
in = new BufferedReader(new InputStreamReader(i));
this.handler = handler;
}
示例6: readDotTerminatedContent
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
/**
* Reads the contents of the stream until
* <CRLF>.<CRLF> is encountered.
* <p/>
* <p/>
* It would be possible and perhaps desirable to prevent the
* adding of an unnecessary CRLF at the end of the message, but
* it hardly seems worth 30 seconds of effort.
* </p>
*/
public void readDotTerminatedContent(BufferedReader in)
throws IOException {
_content = _workspace.getTmpFile();
Writer data = _content.getWriter();
PrintWriter dataWriter = new InternetPrintWriter(data);
while (true) {
String line = in.readLine();
if (line == null)
throw new EOFException("Did not receive <CRLF>.<CRLF>");
if (".".equals(line)) {
dataWriter.close();
break;
} else if (line.startsWith(".")) {
dataWriter.println(line.substring(1));
} else {
dataWriter.println(line);
}
}
try {
message = GreenMailUtil.newMimeMessage(_content.getAsString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例7: ImapResponse
import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
public ImapResponse(OutputStream output) {
this.writer = InternetPrintWriter.createForEncoding(output, true, EncodingUtil.CHARSET_EIGHT_BIT_ENCODING);
}