Examples of LineInputStream


Examples of com.sun.mail.util.LineInputStream

     */
    synchronized boolean uidl(String[] uids) throws IOException {
  Response r = multilineCommand("UIDL", 15 * uids.length);
  if (!r.ok)
      return false;
  LineInputStream lis = new LineInputStream(r.bytes);
  String line = null;
  while ((line = lis.readLine()) != null) {
      int i = line.indexOf(' ');
      if (i < 1 || i >= line.length())
    continue;
      int n = Integer.parseInt(line.substring(0, i));
      if (n > 0 && n <= uids.length)
View Full Code Here

Examples of com.sun.mail.util.LineInputStream

    !ignoreExistingBoundaryParameter)
      throw new MessagingException("Missing boundary parameter");

  try {
      // Skip and save the preamble
      LineInputStream lin = new LineInputStream(in);
      StringBuffer preamblesb = null;
      String line;
      String lineSeparator = null;
      while ((line = lin.readLine()) != null) {
    /*
     * Strip trailing whitespace.  Can't use trim method
     * because it's too aggressive.  Some bogus MIME
     * messages will include control characters in the
     * boundary string.
     */
    int i;
    for (i = line.length() - 1; i >= 0; i--) {
        char c = line.charAt(i);
        if (!(c == ' ' || c == '\t'))
      break;
    }
    line = line.substring(0, i + 1);
    if (boundary != null) {
        if (line.equals(boundary))
      break;
        if (line.length() == boundary.length() + 2 &&
          line.startsWith(boundary) && line.endsWith("--")) {
      line = null// signal end of multipart
      break;
        }
    } else {
        /*
         * Boundary hasn't been defined, does this line
         * look like a boundary?  If so, assume it is
         * the boundary and save it.
         */
        if (line.length() > 2 && line.startsWith("--")) {
      if (line.length() > 4 && allDashes(line)) {
          /*
           * The first boundary-like line we find is
           * probably *not* the end-of-multipart boundary
           * line.  More likely it's a line full of dashes
           * in the preamble text.  Just keep reading.
           */
      } else {
          boundary = line;
          break;
      }
        }
    }

    // save the preamble after skipping blank lines
    if (line.length() > 0) {
        // if we haven't figured out what the line separator
        // is, do it now
        if (lineSeparator == null) {
      try {
          lineSeparator =
        System.getProperty("line.separator", "\n");
      } catch (SecurityException ex) {
          lineSeparator = "\n";
      }
        }
        // accumulate the preamble
        if (preamblesb == null)
      preamblesb = new StringBuffer(line.length() + 2);
        preamblesb.append(line).append(lineSeparator);
    }
      }

      if (preamblesb != null)
    preamble = preamblesb.toString();

      if (line == null) {
    if (allowEmpty)
        return;
    else
        throw new MessagingException("Missing start boundary");
      }

      // save individual boundary bytes for easy comparison later
      byte[] bndbytes = ASCIIUtility.getBytes(boundary);
      int bl = bndbytes.length;
     
      /*
       * Read and process body parts until we see the
       * terminating boundary line (or EOF).
       */
      boolean done = false;
  getparts:
      while (!done) {
    InternetHeaders headers = null;
    if (sin != null) {
        start = sin.getPosition();
        // skip headers
        while ((line = lin.readLine()) != null && line.length() > 0)
      ;
        if (line == null) {
      if (!ignoreMissingEndBoundary)
          throw new MessagingException(
          "missing multipart end boundary");
View Full Code Here

Examples of com.sun.mail.util.LineInputStream

    !ignoreExistingBoundaryParameter)
      throw new MessagingException("Missing boundary parameter");

  try {
      // Skip and save the preamble
      LineInputStream lin = new LineInputStream(in);
      StringBuffer preamblesb = null;
      String line;
      String lineSeparator = null;
      while ((line = lin.readLine()) != null) {
    /*
     * Strip trailing whitespace.  Can't use trim method
     * because it's too aggressive.  Some bogus MIME
     * messages will include control characters in the
     * boundary string.
     */
    int i;
    for (i = line.length() - 1; i >= 0; i--) {
        char c = line.charAt(i);
        if (!(c == ' ' || c == '\t'))
      break;
    }
    line = line.substring(0, i + 1);
    if (boundary != null) {
        if (line.equals(boundary))
      break;
        if (line.length() == boundary.length() + 2 &&
          line.startsWith(boundary) && line.endsWith("--")) {
      line = null// signal end of multipart
      break;
        }
    } else {
        /*
         * Boundary hasn't been defined, does this line
         * look like a boundary?  If so, assume it is
         * the boundary and save it.
         */
        if (line.length() > 2 && line.startsWith("--")) {
      if (line.length() > 4 && allDashes(line)) {
          /*
           * The first boundary-like line we find is
           * probably *not* the end-of-multipart boundary
           * line.  More likely it's a line full of dashes
           * in the preamble text.  Just keep reading.
           */
      } else {
          boundary = line;
          break;
      }
        }
    }

    // save the preamble after skipping blank lines
    if (line.length() > 0) {
        // if we haven't figured out what the line separator
        // is, do it now
        if (lineSeparator == null) {
      try {
          lineSeparator =
        System.getProperty("line.separator", "\n");
      } catch (SecurityException ex) {
          lineSeparator = "\n";
      }
        }
        // accumulate the preamble
        if (preamblesb == null)
      preamblesb = new StringBuffer(line.length() + 2);
        preamblesb.append(line).append(lineSeparator);
    }
      }

      if (preamblesb != null)
    preamble = preamblesb.toString();

      if (line == null) {
    if (allowEmpty)
        return;
    else
        throw new MessagingException("Missing start boundary");
      }

      // save individual boundary bytes for comparison later
      byte[] bndbytes = ASCIIUtility.getBytes(boundary);
      int bl = bndbytes.length;

      /*
       * Compile Boyer-Moore parsing tables.
       */

      // initialize Bad Character Shift table
      int[] bcs = new int[256];
      for (int i = 0; i < bl; i++)
    bcs[bndbytes[i] & 0xff] = i + 1;

      // initialize Good Suffix Shift table
      int[] gss = new int[bl];
  NEXT:
      for (int i = bl; i > 0; i--) {
    int j;  // the beginning index of the suffix being considered
    for (j = bl - 1; j >= i; j--) {
        // Testing for good suffix
        if (bndbytes[j] == bndbytes[j - i]) {
      // bndbytes[j..len] is a good suffix
      gss[j - 1] = i;
        } else {
           // No match. The array has already been
           // filled up with correct values before.
           continue NEXT;
        }
    }
    while (j > 0)
        gss[--j] = i;
      }
      gss[bl - 1] = 1;
      /*
       * Read and process body parts until we see the
       * terminating boundary line (or EOF).
       */
      boolean done = false;
  getparts:
      while (!done) {
    InternetHeaders headers = null;
    if (sin != null) {
        start = sin.getPosition();
        // skip headers
        while ((line = lin.readLine()) != null && line.length() > 0)
      ;
        if (line == null) {
      if (!ignoreMissingEndBoundary)
          throw new MessagingException(
          "missing multipart end boundary");
View Full Code Here

Examples of com.sun.xml.internal.messaging.saaj.packaging.mime.util.LineInputStream

     */
    public void load(InputStream is) throws MessagingException {
        // Read header lines until a blank line. It is valid
        // to have BodyParts with no header lines.
        String line;
        LineInputStream lis = new LineInputStream(is);
        String prevline = null; // the previous header line, as a string
        // a buffer to accumulate the header in, when we know it's needed
        StringBuffer lineBuffer = new StringBuffer();

        try {
            //while ((line = lis.readLine()) != null) {
            do {
                line = lis.readLine();
                if (line != null &&
                        (line.startsWith(" ") || line.startsWith("\t"))) {
                    // continuation of header
                    if (prevline != null) {
                        lineBuffer.append(prevline);
View Full Code Here

Examples of com.sun.xml.internal.messaging.saaj.packaging.mime.util.LineInputStream

     */
    public void load(InputStream is) throws MessagingException {
        // Read header lines until a blank line. It is valid
        // to have BodyParts with no header lines.
        String line;
        LineInputStream lis = new LineInputStream(is);
        String prevline = null; // the previous header line, as a string
        // a buffer to accumulate the header in, when we know it's needed
        StringBuffer lineBuffer = new StringBuffer();

        try {
            //while ((line = lis.readLine()) != null) {
            do {
                line = lis.readLine();
                if (line != null &&
                        (line.startsWith(" ") || line.startsWith("\t"))) {
                    // continuation of header
                    if (prevline != null) {
                        lineBuffer.append(prevline);
View Full Code Here

Examples of com.sun.xml.messaging.saaj.packaging.mime.util.LineInputStream

     */
    public void load(InputStream is) throws MessagingException {
        // Read header lines until a blank line. It is valid
        // to have BodyParts with no header lines.
        String line;
        LineInputStream lis = new LineInputStream(is);
        String prevline = null// the previous header line, as a string
        // a buffer to accumulate the header in, when we know it's needed
        StringBuffer lineBuffer = new StringBuffer();

        try {
            //while ((line = lis.readLine()) != null) {
            do {
                line = lis.readLine();
                if (line != null &&
                        (line.startsWith(" ") || line.startsWith("\t"))) {
                    // continuation of header
                    if (prevline != null) {
                        lineBuffer.append(prevline);
View Full Code Here

Examples of com.sun.xml.messaging.saaj.packaging.mime.util.LineInputStream

     */
    public void load(InputStream is) throws MessagingException {
        // Read header lines until a blank line. It is valid
        // to have BodyParts with no header lines.
        String line;
        LineInputStream lis = new LineInputStream(is);
        String prevline = null// the previous header line, as a string
        // a buffer to accumulate the header in, when we know it's needed
        StringBuffer lineBuffer = new StringBuffer();

        try {
            //while ((line = lis.readLine()) != null) {
            do {
                line = lis.readLine();
                if (line != null &&
                        (line.startsWith(" ") || line.startsWith("\t"))) {
                    // continuation of header
                    if (prevline != null) {
                        lineBuffer.append(prevline);
View Full Code Here

Examples of com.sun.xml.messaging.saaj.packaging.mime.util.LineInputStream

     */
    public void load(InputStream is) throws MessagingException {
        // Read header lines until a blank line. It is valid
        // to have BodyParts with no header lines.
        String line;
        LineInputStream lis = new LineInputStream(is);
        String prevline = null// the previous header line, as a string
        // a buffer to accumulate the header in, when we know it's needed
        StringBuffer lineBuffer = new StringBuffer();

        try {
            //while ((line = lis.readLine()) != null) {
            do {
                line = lis.readLine();
                if (line != null &&
                        (line.startsWith(" ") || line.startsWith("\t"))) {
                    // continuation of header
                    if (prevline != null) {
                        lineBuffer.append(prevline);
View Full Code Here

Examples of gnu.java.net.LineInputStream

   * @throws IOException if I/O error occured.
   */
  public void parse(InputStream in)
    throws IOException
  {
    LineInputStream lin = (in instanceof LineInputStream) ?
      (LineInputStream) in : new LineInputStream(in);

    String name = null;
    StringBuilder value = new StringBuilder();
    while (true)
      {
        String line = lin.readLine();
        if (line == null)
          {
            if (name != null)
              {
                addValue(name, value.toString());
View Full Code Here

Examples of gnu.java.net.LineInputStream

  {
    String line;
    int len;

    // Read response status line
    LineInputStream lis = new LineInputStream(in);

    line = lis.readLine();
    if (line == null)
      {
        throw new ProtocolException("Peer closed connection");
      }
    if (!line.startsWith("HTTP/"))
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.