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

Unified Diff: pkg/http/lib/src/utils.dart

Issue 12351006: Change MultipartFile.fromFile to MultipartFile.fromPath in pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/lib/src/multipart_file.dart ('k') | pkg/http/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/utils.dart
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index c0fe9f5d852e8cd2ad637bfe6bd2a79067628772..caef51fbed363e1d62f5064d68cc4a93f1d4af0e 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -149,65 +149,6 @@ Stream onDone(Stream stream, void onDone()) {
return pair.last;
}
-// TODO(nweiz): remove this once issue 7785 is fixed.
-/// Wraps [stream] in a single-subscription [ByteStream] that emits the same
-/// data.
-ByteStream wrapInputStream(InputStream stream) {
- if (stream.closed) return emptyStream;
-
- var controller = new StreamController();
- stream.onClosed = controller.close;
- stream.onData = () => controller.add(stream.read());
- stream.onError = (e) => controller.signalError(new AsyncError(e));
- return new ByteStream(controller.stream);
-}
-
-// TODO(nweiz): remove this once issue 7785 is fixed.
-/// Wraps [stream] in a [StreamConsumer] so that [Stream]s can by piped into it
-/// using [Stream.pipe].
-StreamConsumer<List<int>, dynamic> wrapOutputStream(OutputStream stream) =>
- new _OutputStreamConsumer(stream);
-
-/// A [StreamConsumer] that pipes data into an [OutputStream].
-class _OutputStreamConsumer implements StreamConsumer<List<int>, dynamic> {
- final OutputStream _outputStream;
-
- _OutputStreamConsumer(this._outputStream);
-
- Future consume(Stream<List<int>> stream) {
- // TODO(nweiz): we have to manually keep track of whether or not the
- // completer has completed since the output stream could signal an error
- // after close() has been called but before it has shut down internally. See
- // the following TODO.
- var completed = false;
- var completer = new Completer();
- stream.listen((data) {
- // Writing empty data to a closed stream can cause errors.
- if (data.isEmpty) return;
-
- // TODO(nweiz): remove this try/catch when issue 7836 is fixed.
- try {
- _outputStream.write(data);
- } catch (e, stack) {
- if (!completed) completer.completeError(e, stack);
- completed = true;
- }
- }, onDone: () => _outputStream.close());
-
- _outputStream.onError = (e) {
- if (!completed) completer.completeError(e);
- completed = true;
- };
-
- _outputStream.onClosed = () {
- if (!completed) completer.complete();
- completed = true;
- };
-
- return completer.future;
- }
-}
-
// TODO(nweiz): remove this when issue 7786 is fixed.
/// Pipes all data and errors from [stream] into [sink]. When [stream] is done,
/// [sink] is closed and the returned [Future] is completed.
« no previous file with comments | « pkg/http/lib/src/multipart_file.dart ('k') | pkg/http/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698