| 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 /** | 5 /** |
| 6 * Parser for MIME multipart types of data as described in RFC 2046 | 6 * Parser for MIME multipart types of data as described in RFC 2046 |
| 7 * section 5.1.1. The data to parse is supplied through the [:update:] | 7 * section 5.1.1. The data to parse is supplied through the [:update:] |
| 8 * method. As the data is parsed the following callbacks are called: | 8 * method. As the data is parsed the following callbacks are called: |
| 9 * | 9 * |
| 10 * [:partStart; | 10 * [:partStart; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 _boundary[0] = _CharCode.CR; | 46 _boundary[0] = _CharCode.CR; |
| 47 _boundary[1] = _CharCode.LF; | 47 _boundary[1] = _CharCode.LF; |
| 48 _boundary[2] = _CharCode.DASH; | 48 _boundary[2] = _CharCode.DASH; |
| 49 _boundary[3] = _CharCode.DASH; | 49 _boundary[3] = _CharCode.DASH; |
| 50 _boundary.setRange(4, charCodes.length, charCodes); | 50 _boundary.setRange(4, charCodes.length, charCodes); |
| 51 _state = _START; | 51 _state = _START; |
| 52 _headerField = new StringBuffer(); | 52 _headerField = new StringBuffer(); |
| 53 _headerValue = new StringBuffer(); | 53 _headerValue = new StringBuffer(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 int update(List<int> buffer, int offset, int count) { | 56 void update(List<int> buffer, int offset, int count) { |
| 57 // Current index in the data buffer. If index is negative then it | 57 // Current index in the data buffer. If index is negative then it |
| 58 // is the index into the artificial prefix of the boundary string. | 58 // is the index into the artificial prefix of the boundary string. |
| 59 int index; | 59 int index; |
| 60 // Number of boundary bytes to artificially place before the supplied data. | 60 // Number of boundary bytes to artificially place before the supplied data. |
| 61 int boundaryPrefix = 0; | 61 int boundaryPrefix = 0; |
| 62 // Position where content starts. Will be null if no known content | 62 // Position where content starts. Will be null if no known content |
| 63 // start exists. Will be negative of the content starts in the | 63 // start exists. Will be negative of the content starts in the |
| 64 // boundary prefix. Will be zero or position if the content starts | 64 // boundary prefix. Will be zero or position if the content starts |
| 65 // in the current buffer. | 65 // in the current buffer. |
| 66 int contentStartIndex; | 66 int contentStartIndex; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 Function partDataReceived; | 322 Function partDataReceived; |
| 323 Function partEnd; | 323 Function partEnd; |
| 324 } | 324 } |
| 325 | 325 |
| 326 | 326 |
| 327 class MimeParserException implements Exception { | 327 class MimeParserException implements Exception { |
| 328 const MimeParserException([String this.message = ""]); | 328 const MimeParserException([String this.message = ""]); |
| 329 String toString() => "MimeParserException: $message"; | 329 String toString() => "MimeParserException: $message"; |
| 330 final String message; | 330 final String message; |
| 331 } | 331 } |
| OLD | NEW |