OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 // Frequently used character codes. | 7 // Frequently used character codes. |
8 const int _SPACE = 0x20; | 8 const int _SPACE = 0x20; |
9 const int _PERCENT = 0x25; | 9 const int _PERCENT = 0x25; |
10 const int _AMPERSAND = 0x26; | 10 const int _AMPERSAND = 0x26; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 * then encodes the bytes into the resulting data URI. | 276 * then encodes the bytes into the resulting data URI. |
277 * | 277 * |
278 * Defaults to encoding using percent-encoding (any non-ASCII or non-URI-valid | 278 * Defaults to encoding using percent-encoding (any non-ASCII or non-URI-valid |
279 * bytes is replaced by a percent encoding). If [base64] is true, the bytes | 279 * bytes is replaced by a percent encoding). If [base64] is true, the bytes |
280 * are instead encoded using [BASE64]. | 280 * are instead encoded using [BASE64]. |
281 * | 281 * |
282 * If [encoding] is not provided and [parameters] has a `charset` entry, | 282 * If [encoding] is not provided and [parameters] has a `charset` entry, |
283 * that name is looked up using [Encoding.getByName], | 283 * that name is looked up using [Encoding.getByName], |
284 * and if the lookup returns an encoding, that encoding is used to convert | 284 * and if the lookup returns an encoding, that encoding is used to convert |
285 * [content] to bytes. | 285 * [content] to bytes. |
286 * If providing both an [encoding] and a charset [parameter], they should | 286 * If providing both an [encoding] and a charset in [parameters], they should |
287 * agree, otherwise decoding won't be able to use the charset parameter | 287 * agree, otherwise decoding won't be able to use the charset parameter |
288 * to determine the encoding. | 288 * to determine the encoding. |
289 * | 289 * |
290 * If [mimeType] and/or [parameters] are supplied, they are added to the | 290 * If [mimeType] and/or [parameters] are supplied, they are added to the |
291 * created URI. If any of these contain characters that are not allowed | 291 * created URI. If any of these contain characters that are not allowed |
292 * in the data URI, the character is percent-escaped. If the character is | 292 * in the data URI, the character is percent-escaped. If the character is |
293 * non-ASCII, it is first UTF-8 encoded and then the bytes are percent | 293 * non-ASCII, it is first UTF-8 encoded and then the bytes are percent |
294 * encoded. An omitted [mimeType] in a data URI means `text/plain`, just | 294 * encoded. An omitted [mimeType] in a data URI means `text/plain`, just |
295 * as an omitted `charset` parameter defaults to meaning `US-ASCII`. | 295 * as an omitted `charset` parameter defaults to meaning `US-ASCII`. |
296 * | 296 * |
(...skipping 4333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; | 4630 int delta = (text.codeUnitAt(start + 4) ^ _COLON) * 3; |
4631 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; | 4631 delta |= text.codeUnitAt(start) ^ 0x64 /*d*/; |
4632 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; | 4632 delta |= text.codeUnitAt(start + 1) ^ 0x61 /*a*/; |
4633 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; | 4633 delta |= text.codeUnitAt(start + 2) ^ 0x74 /*t*/; |
4634 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; | 4634 delta |= text.codeUnitAt(start + 3) ^ 0x61 /*a*/; |
4635 return delta; | 4635 return delta; |
4636 } | 4636 } |
4637 | 4637 |
4638 /// Helper function returning the length of a string, or `0` for `null`. | 4638 /// Helper function returning the length of a string, or `0` for `null`. |
4639 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; | 4639 int _stringOrNullLength(String s) => (s == null) ? 0 : s.length; |
OLD | NEW |