Chromium Code Reviews| 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.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * A Mime Multipart class representing each part parsed by | 9 * A Mime Multipart class representing each part parsed by |
| 10 * [MimeMultipartTransformer]. The data is streamed in as it become available. | 10 * [MimeMultipartTransformer]. The data is streamed in as it become available. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 | 93 |
| 94 void _resumeStream() { | 94 void _resumeStream() { |
| 95 _subscription.resume(); | 95 _subscription.resume(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void _pauseStream() { | 98 void _pauseStream() { |
| 99 _subscription.pause(); | 99 _subscription.pause(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 Stream<MimeMultipart> bind(Stream<List<int>> stream) { | 102 Stream<MimeMultipart> bind(Stream<List<int>> stream) { |
| 103 _controller = new StreamController( | 103 _controller = new StreamController(sync: true, |
|
floitsch
2013/05/30 12:13:48
next line
Lasse Reichstein Nielsen
2013/05/31 05:51:59
Done.
| |
| 104 onPause: _pauseStream, | 104 onPause: _pauseStream, |
| 105 onResume:_resumeStream, | 105 onResume:_resumeStream, |
| 106 onCancel: () { | 106 onCancel: () { |
| 107 _subscription.cancel(); | 107 _subscription.cancel(); |
| 108 }, | 108 }, |
| 109 onListen: () { | 109 onListen: () { |
| 110 _subscription = stream.listen( | 110 _subscription = stream.listen( |
| 111 (data) { | 111 (data) { |
| 112 assert(_buffer == null); | 112 assert(_buffer == null); |
| 113 _pauseStream(); | 113 _pauseStream(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 } else { | 285 } else { |
| 286 // Start of new header field. | 286 // Start of new header field. |
| 287 _headerField.writeCharCode(_toLowerCase(byte)); | 287 _headerField.writeCharCode(_toLowerCase(byte)); |
| 288 _state = _HEADER_FIELD; | 288 _state = _HEADER_FIELD; |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 break; | 291 break; |
| 292 | 292 |
| 293 case _HEADER_ENDING: | 293 case _HEADER_ENDING: |
| 294 _expect(byte, _CharCode.LF); | 294 _expect(byte, _CharCode.LF); |
| 295 _multipartController = new StreamController( | 295 _multipartController = new StreamController(sync: true, |
|
floitsch
2013/05/30 12:13:48
ditto.
Lasse Reichstein Nielsen
2013/05/31 05:51:59
Done.
| |
| 296 onPause: () { | 296 onPause: () { |
| 297 _pauseStream(); | 297 _pauseStream(); |
| 298 }, | 298 }, |
| 299 onResume: () { | 299 onResume: () { |
| 300 _resumeStream(); | 300 _resumeStream(); |
| 301 _parse(); | 301 _parse(); |
| 302 }); | 302 }); |
| 303 _controller.add( | 303 _controller.add( |
| 304 new _MimeMultipart(_headers, _multipartController.stream)); | 304 new _MimeMultipart(_headers, _multipartController.stream)); |
| 305 _headers = null; | 305 _headers = null; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 | 398 |
| 399 class MimeMultipartException implements Exception { | 399 class MimeMultipartException implements Exception { |
| 400 const MimeMultipartException([String this.message = ""]); | 400 const MimeMultipartException([String this.message = ""]); |
| 401 String toString() => "MimeMultipartException: $message"; | 401 String toString() => "MimeMultipartException: $message"; |
| 402 final String message; | 402 final String message; |
| 403 } | 403 } |
| OLD | NEW |