src/java.desktop/share/classes/java/awt/datatransfer/MimeTypeParameterList.java

Print this page




 146 
 147                         //    skip whitespace
 148                         currentIndex = skipWhiteSpace(rawdata, currentIndex);
 149 
 150                         if((currentIndex < length) && (rawdata.charAt(currentIndex) == '='))  {
 151                             //    eat it and parse the parameter value
 152                             ++currentIndex;
 153 
 154                             //    skip whitespace
 155                             currentIndex = skipWhiteSpace(rawdata, currentIndex);
 156 
 157                             if(currentIndex < length) {
 158                                 //    now find out whether or not we have a quoted value
 159                                 currentChar = rawdata.charAt(currentIndex);
 160                                 if(currentChar == '"') {
 161                                     //    yup it's quoted so eat it and capture the quoted string
 162                                     ++currentIndex;
 163                                     lastIndex = currentIndex;
 164 
 165                                     if(currentIndex < length) {
 166                                         //    find the next unescqped quote
 167                                         foundit = false;
 168                                         while((currentIndex < length) && !foundit) {
 169                                             currentChar = rawdata.charAt(currentIndex);
 170                                             if(currentChar == '\\') {
 171                                                 //    found an escape sequence so pass this and the next character
 172                                                 currentIndex += 2;
 173                                             } else if(currentChar == '"') {
 174                                                 //    foundit!
 175                                                 foundit = true;
 176                                             } else {
 177                                                 ++currentIndex;
 178                                             }
 179                                         }
 180                                         if(currentChar == '"') {
 181                                             value = unquote(rawdata.substring(lastIndex, currentIndex));
 182                                             //    eat the quote
 183                                             ++currentIndex;
 184                                         } else {
 185                                             throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
 186                                         }
 187                                     } else {
 188                                         throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
 189                                     }
 190                                 } else if(isTokenChar(currentChar)) {
 191                                     //    nope it's an ordinary token so it ends with a non-token char
 192                                     lastIndex = currentIndex;
 193                                     foundit = false;
 194                                     while((currentIndex < length) && !foundit) {




 146 
 147                         //    skip whitespace
 148                         currentIndex = skipWhiteSpace(rawdata, currentIndex);
 149 
 150                         if((currentIndex < length) && (rawdata.charAt(currentIndex) == '='))  {
 151                             //    eat it and parse the parameter value
 152                             ++currentIndex;
 153 
 154                             //    skip whitespace
 155                             currentIndex = skipWhiteSpace(rawdata, currentIndex);
 156 
 157                             if(currentIndex < length) {
 158                                 //    now find out whether or not we have a quoted value
 159                                 currentChar = rawdata.charAt(currentIndex);
 160                                 if(currentChar == '"') {
 161                                     //    yup it's quoted so eat it and capture the quoted string
 162                                     ++currentIndex;
 163                                     lastIndex = currentIndex;
 164 
 165                                     if(currentIndex < length) {
 166                                         //    find the next unescaped quote
 167                                         foundit = false;
 168                                         while((currentIndex < length) && !foundit) {
 169                                             currentChar = rawdata.charAt(currentIndex);
 170                                             if(currentChar == '\\') {
 171                                                 //    found an escape sequence so pass this and the next character
 172                                                 currentIndex += 2;
 173                                             } else if(currentChar == '"') {
 174                                                 //    found it!
 175                                                 foundit = true;
 176                                             } else {
 177                                                 ++currentIndex;
 178                                             }
 179                                         }
 180                                         if(currentChar == '"') {
 181                                             value = unquote(rawdata.substring(lastIndex, currentIndex));
 182                                             //    eat the quote
 183                                             ++currentIndex;
 184                                         } else {
 185                                             throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
 186                                         }
 187                                     } else {
 188                                         throw new MimeTypeParseException("Encountered unterminated quoted parameter value.");
 189                                     }
 190                                 } else if(isTokenChar(currentChar)) {
 191                                     //    nope it's an ordinary token so it ends with a non-token char
 192                                     lastIndex = currentIndex;
 193                                     foundit = false;
 194                                     while((currentIndex < length) && !foundit) {