jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/HeaderTokenizer.java
changeset 43852 93a527059d8a
parent 33547 e4c76ac38b12
equal deleted inserted replaced
43752:3c68ef249093 43852:93a527059d8a
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    93          * delimiter or a control character, the type is that character
    93          * delimiter or a control character, the type is that character
    94          * itself, converted to an integer. Otherwise, it's value is
    94          * itself, converted to an integer. Otherwise, it's value is
    95          * one of the following:
    95          * one of the following:
    96          * <ul>
    96          * <ul>
    97          * <li><code>ATOM</code> A sequence of ASCII characters
    97          * <li><code>ATOM</code> A sequence of ASCII characters
    98          *      delimited by either SPACE, CTL, "(", <"> or the
    98          *      delimited by either SPACE, CTL, "(", &lt;"&gt; or the
    99          *      specified SPECIALS
    99          *      specified SPECIALS</li>
   100          * <li><code>QUOTEDSTRING</code> A sequence of ASCII characters
   100          * <li><code>QUOTEDSTRING</code> A sequence of ASCII characters
   101          *      within quotes
   101          *      within quotes</li>
   102          * <li><code>COMMENT</code> A sequence of ASCII characters
   102          * <li><code>COMMENT</code> A sequence of ASCII characters
   103          *      within "(" and ")".
   103          *      within "(" and ")".</li>
   104          * <li><code>EOF</code> End of header
   104          * <li><code>EOF</code> End of header</li>
   105          * </ul>
   105          * </ul>
       
   106          * @return type
   106          */
   107          */
   107         public int getType() {
   108         public int getType() {
   108             return type;
   109             return type;
   109         }
   110         }
   110 
   111 
   174 
   175 
   175     /**
   176     /**
   176      * Constructor. The RFC822 defined delimiters - RFC822 - are
   177      * Constructor. The RFC822 defined delimiters - RFC822 - are
   177      * used to delimit ATOMS. Also comments are skipped and not
   178      * used to delimit ATOMS. Also comments are skipped and not
   178      * returned as tokens
   179      * returned as tokens
       
   180      * @param header The header that is tokenized.
   179      */
   181      */
   180     public HeaderTokenizer(String header)  {
   182     public HeaderTokenizer(String header)  {
   181         this(header, RFC822);
   183         this(header, RFC822);
   182     }
   184     }
   183 
   185 
   315         // Check for SPECIAL or CTL
   317         // Check for SPECIAL or CTL
   316         if (c < 040 || c >= 0177 || delimiters.indexOf(c) >= 0) {
   318         if (c < 040 || c >= 0177 || delimiters.indexOf(c) >= 0) {
   317             currentPos++; // re-position currentPos
   319             currentPos++; // re-position currentPos
   318             char ch[] = new char[1];
   320             char ch[] = new char[1];
   319             ch[0] = c;
   321             ch[0] = c;
   320             return new Token((int)c, new String(ch));
   322             return new Token(c, new String(ch));
   321         }
   323         }
   322 
   324 
   323         // Check for ATOM
   325         // Check for ATOM
   324         for (start = currentPos; currentPos < maxPos; currentPos++) {
   326         for (start = currentPos; currentPos < maxPos; currentPos++) {
   325             c = string.charAt(currentPos);
   327             c = string.charAt(currentPos);