Package org.subethamail.smtp.io

Examples of org.subethamail.smtp.io.ExtraDotOutputStream


      this.reader = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));

      this.rawOutput = this.socket.getOutputStream();
      this.dotTerminatedOutput = new DotTerminatedOutputStream(this.rawOutput);
      this.dataOutput = new ExtraDotOutputStream(this.dotTerminatedOutput);
      this.writer = new PrintWriter(this.rawOutput, true);
    }
    catch (IOException e)
    {
      close();
View Full Code Here


        InputStream mailAsStream =
                session.getMaildrop().getMailAsStream(messageNumber);
        try {
            session.getThread().sendResponse("+OK");
            ExtraDotOutputStream dotOutputStream =
                    new ExtraDotOutputStream(session.getThread()
                            .getOutputStream());
            CrLfInputStream in = new CrLfInputStream(mailAsStream);
            byte[] buffer = new byte[1000];
            int cRead;
            // read headers
            while (true) {
                cRead = in.readLineWithEol(buffer);
                if (cRead == -1)
                    break; // no body
                dotOutputStream.write(buffer, 0, cRead);
                if (buffer[0] == '\r' || buffer[0] == '\n')
                    break;
            }
            // read body
            int cLines = 0;
            while (cLines < lines) {
                try {
                    cRead = in.readLineWithEol(buffer);
                } catch (MaxLineLengthException e) {
                    // not a big problem, some body lines will be missing
                    break;
                }
                if (cRead == -1)
                    break; // end of mail
                dotOutputStream.write(buffer, 0, cRead);
                cLines++;
            }

            dotOutputStream.flush();
        } finally {
            mailAsStream.close();
        }
        session.getThread().sendResponse(".");
    }
View Full Code Here

            session.getThread().sendResponse(
                    "+OK " + scanListing.length + " octets");
            DotTerminatedOutputStream dotTerminatedOutputStream =
                    new DotTerminatedOutputStream(session.getThread()
                            .getOutputStream());
            ExtraDotOutputStream dotOutputStream =
                    new ExtraDotOutputStream(dotTerminatedOutputStream);
            byte[] buffer = new byte[4096];
            int cRead;
            while (-1 != (cRead = mailAsStream.read(buffer))) {
                dotOutputStream.write(buffer, 0, cRead);
            }
            dotOutputStream.flush();
            dotTerminatedOutputStream.writeTerminatingSequence();
            dotTerminatedOutputStream.flush();
            logger.debug("Message sent");
        } finally {
            mailAsStream.close();
View Full Code Here

    this.socket = new Socket(host, port);
    this.reader = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));

    this.rawOutput = this.socket.getOutputStream();
    this.dataOutput = new ExtraDotOutputStream(this.rawOutput);
    this.writer = new PrintWriter(this.rawOutput, true);
  }
View Full Code Here

TOP

Related Classes of org.subethamail.smtp.io.ExtraDotOutputStream

Copyright © 2018 www.massapicom. 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.