当前位置: 首页>>代码示例>>Java>>正文


Java InternetPrintWriter类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:36,代码来源:MovingMessage.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:13,代码来源:SmtpConnection.java

示例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();
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:9,代码来源:ImapResponse.java

示例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));
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:8,代码来源:Pop3Connection.java

示例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;
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:13,代码来源:SmtpConnection.java

示例6: readDotTerminatedContent

import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
/**
 * Reads the contents of the stream until
 * &lt;CRLF&gt;.&lt;CRLF&gt; 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);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:38,代码来源:MovingMessage.java

示例7: ImapResponse

import com.icegreen.greenmail.util.InternetPrintWriter; //导入依赖的package包/类
public ImapResponse(OutputStream output) {
    this.writer = InternetPrintWriter.createForEncoding(output, true, EncodingUtil.CHARSET_EIGHT_BIT_ENCODING);
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:4,代码来源:ImapResponse.java


注:本文中的com.icegreen.greenmail.util.InternetPrintWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。