當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。