Package com.sun.mail.util

Examples of com.sun.mail.util.SharedByteArrayOutputStream


     * The size parameter indicates the expected size of the response;
     * the actual size can be different.  Returns an InputStream to the
     * response bytes.
     */
    private InputStream readMultilineResponse(int size) throws IOException {
  SharedByteArrayOutputStream buf = new SharedByteArrayOutputStream(size);
  int b, lastb = '\n';
  try {
      while ((b = input.read()) >= 0) {
    if (lastb == '\n' && b == '.') {
        if (debug && !traceSuspended)
      out.write(b);
        b = input.read();
        if (b == '\r') {
      if (debug && !traceSuspended)
          out.write(b);
      // end of response, consume LF as well
      b = input.read();
      if (debug && !traceSuspended)
          out.write(b);
      break;
        }
    }
    buf.write(b);
    if (debug && !traceSuspended)
        out.write(b);
    lastb = b;
      }
  } catch (InterruptedIOException iioex) {
      /*
       * As above in readResponse, close the socket to recover.
       */
      try {
    socket.close();
      } catch (IOException cex) { }
      throw iioex;
  }
  if (b < 0)
      throw new EOFException("EOF on socket");
  return buf.toStream();
    }
View Full Code Here

TOP

Related Classes of com.sun.mail.util.SharedByteArrayOutputStream

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.