Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: sdk/lib/io/mime_multipart_parser.dart

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Parser for MIME multipart types of data as described in RFC 2046 8 * Parser for MIME multipart types of data as described in RFC 2046
9 * section 5.1.1. The data to parse is supplied through the [:update:] 9 * section 5.1.1. The data to parse is supplied through the [:update:]
10 * method. As the data is parsed the following callbacks are called: 10 * method. As the data is parsed the following callbacks are called:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // type parameter, that is without the -- prefix. 42 // type parameter, that is without the -- prefix.
43 _MimeMultipartParser(String boundary) { 43 _MimeMultipartParser(String boundary) {
44 List<int> charCodes = boundary.codeUnits; 44 List<int> charCodes = boundary.codeUnits;
45 _boundary = new List<int>(4 + charCodes.length); 45 _boundary = new List<int>(4 + charCodes.length);
46 // Set-up the matching boundary preceding it with CRLF and two 46 // Set-up the matching boundary preceding it with CRLF and two
47 // dashes. 47 // dashes.
48 _boundary[0] = _CharCode.CR; 48 _boundary[0] = _CharCode.CR;
49 _boundary[1] = _CharCode.LF; 49 _boundary[1] = _CharCode.LF;
50 _boundary[2] = _CharCode.DASH; 50 _boundary[2] = _CharCode.DASH;
51 _boundary[3] = _CharCode.DASH; 51 _boundary[3] = _CharCode.DASH;
52 _boundary.setRange(4, charCodes.length, charCodes); 52 _boundary.setRange(4, 4 + charCodes.length, charCodes);
53 _state = _START; 53 _state = _START;
54 _headerField = new StringBuffer(); 54 _headerField = new StringBuffer();
55 _headerValue = new StringBuffer(); 55 _headerValue = new StringBuffer();
56 } 56 }
57 57
58 int update(List<int> buffer, int offset, int count) { 58 int update(List<int> buffer, int offset, int count) {
59 // Current index in the data buffer. If index is negative then it 59 // Current index in the data buffer. If index is negative then it
60 // is the index into the artificial prefix of the boundary string. 60 // is the index into the artificial prefix of the boundary string.
61 int index; 61 int index;
62 // Number of boundary bytes to artificially place before the supplied data. 62 // Number of boundary bytes to artificially place before the supplied data.
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 Function partDataReceived; 324 Function partDataReceived;
325 Function partEnd; 325 Function partEnd;
326 } 326 }
327 327
328 328
329 class MimeParserException implements Exception { 329 class MimeParserException implements Exception {
330 const MimeParserException([String this.message = ""]); 330 const MimeParserException([String this.message = ""]);
331 String toString() => "MimeParserException: $message"; 331 String toString() => "MimeParserException: $message";
332 final String message; 332 final String message;
333 } 333 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698