Examples of InternetPrintWriter


Examples of org.apache.james.util.InternetPrintWriter

            //First handle the headers
            InputStream in = source.getInputStream();
            try {
                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();
                pos.flush();
                IOUtils.copy(in, bodyOs);
            } finally {
                IOUtils.closeQuietly(in);
            }
        } else {
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

     * @param headers the Enumeration which holds the headers
     * @param headerOs the OutputStream to which the headers get written
     * @throws MessagingException
     */
    public static void writeHeadersTo(Enumeration headers, OutputStream headerOs) throws MessagingException {
        PrintWriter hos = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(headerOs), 512), true);
        while (headers.hasMoreElements()) {
            hos.println((String)headers.nextElement());
        }
        // Print header/data separator
        hos.println();
        hos.flush();
    }
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

            // An ASCII encoding can be used because all transmissions other
            // that those in the message body command are guaranteed
            // to be ASCII
            reader = new BufferedReader(new InputStreamReader(in, "ASCII"), 512);
            outs = new BufferedOutputStream(socket.getOutputStream(), 1024);
            writer = new InternetPrintWriter(outs, true);
        } catch (Exception e) {
            StringBuffer exceptionBuffer =
                new StringBuffer(256)
                    .append("Cannot open connection from ")
                    .append(remoteHost)
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

Examples of org.apache.james.util.InternetPrintWriter

            getLogger().info(logBuffer.toString());
        }

        try {
            outs = new BufferedOutputStream(socket.getOutputStream(), 1024);
            out = new InternetPrintWriter(outs, true);
            state = AUTHENTICATION_READY;
            user = "unknown";
            StringBuffer responseBuffer =
                new StringBuffer(256)
                        .append(OK_RESPONSE)
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

    private PrintWriter 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

            getLogger().info( logBuffer.toString() );
        }

        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 org.apache.james.util.InternetPrintWriter

            //First handle the headers
            InputStream in = source.getInputStream();
            try {
                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();
                pos.flush();
                copyStream(in, bodyOs);
            } finally {
                IOUtil.shutdownStream(in);
            }
        } else {
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

                message.saveChanges();
            }

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

            InputStream bis = null;
            OutputStream bos = null;
            // Write the body to the output stream
View Full Code Here

Examples of org.apache.james.util.InternetPrintWriter

            getLogger().info(infoBuffer.toString());
        }

        try {

            out = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()), 1024), false);

            // Initially greet the connector
            // Format is:  Sat, 24 Jan 1998 13:16:09 -0500

            responseBuffer.append("220 ")
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.