Examples of InternetPrintWriter


Examples of com.icegreen.greenmail.util.InternetPrintWriter

     */
    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.instance().newMimeMessage(_content.getAsString());
        } catch (Exception e) {
View Full Code Here

Examples of com.icegreen.greenmail.util.InternetPrintWriter

            throw e;
        }

        try {
            outs = new BufferedOutputStream(socket.getOutputStream(), 1024);
            out = new InternetPrintWriter(outs, true);
            ImapResponse response = new ImapResponse(outs);

            // Write welcome message
            StringBuffer responseBuffer =
                    new StringBuffer(256)
View Full Code Here

Examples of com.icegreen.greenmail.util.InternetPrintWriter

        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;
    }
View Full Code Here

Examples of com.icegreen.greenmail.util.InternetPrintWriter

    private void configureStreams()
            throws IOException {
        OutputStream o = _socket.getOutputStream();
        InputStream i = _socket.getInputStream();
        _out = new InternetPrintWriter(o, true);
        _in = new BufferedReader(new InputStreamReader(i));
    }
View Full Code Here

Examples of com.icegreen.greenmail.util.InternetPrintWriter

public class ImapResponse implements ImapConstants {
    private InternetPrintWriter writer;
    private String tag = UNTAGGED;

    public ImapResponse(OutputStream output) {
        this.writer = new InternetPrintWriter(output, true);
    }
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

            //  and write to this outputstream

            //First handle the headers
            InputStream in = source.getInputStream();
            InternetHeaders headers = new InternetHeaders(in);
            PrintWriter pos = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(headerOs), 512), true);
            for (Enumeration e = headers.getNonMatchingHeaderLines(ignoreList); e.hasMoreElements(); ) {
                String header = (String)e.nextElement();
                pos.println(header);
            }
            pos.println();
            // TODO: This is really a bad way to do this sort of thing.  A shared buffer to
            //       allow simultaneous read/writes would be a substantial improvement
            byte[] block = new byte[1024];
            int read = 0;
            while ((read = in.read(block)) > 0) {
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

        } else {
            message.saveChanges();

            //Write the headers (minus ignored ones)
            Enumeration headers = message.getNonMatchingHeaderLines(ignoreList);
            PrintWriter pos = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(headerOs), 512), true);
            while (headers.hasMoreElements()) {
                pos.println((String)headers.nextElement());
            }

            //Write the message without any headers

            //Get a list of all headers
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

            this.socket = connection;
            synchronized (this) {
                handlerThread = Thread.currentThread();
            }
            reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), "ASCII"), 1024);
            writer = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()), 1024), true);
        } catch (Exception e) {
            getLogger().error( "Cannot open connection from: " + e.getMessage(), e );
        }

        try {
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

        try {
            this.socket = connection;
            in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            outs = socket.getOutputStream();
            out = new InternetPrintWriter(outs, true);
            remoteHost = socket.getInetAddress ().getHostName ();
            remoteIP = socket.getInetAddress ().getHostAddress ();
        } catch (Exception e) {
            getLogger().error( "Cannot open connection from " + remoteHost +
                               " (" + remoteIP + "): " + e.getMessage(), e );
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

        try {
            this.socket = connection;
            setIn( new BufferedReader( new
                    InputStreamReader( socket.getInputStream() ) ) );
            outs = socket.getOutputStream();
            setOut( new InternetPrintWriter( outs, true ) );
            remoteHost = socket.getInetAddress().getHostName();
            remoteIP = socket.getInetAddress().getHostAddress();
        }
        catch ( Exception e ) {
            getLogger().error( "Cannot open connection from " + getRemoteHost() + " ("
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.