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

Unified Diff: runtime/bin/stream_util.dart

Issue 9653026: Add writeString method to OutputStream (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 8 years, 9 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 | « runtime/bin/socket_stream_impl.dart ('k') | runtime/bin/string_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/stream_util.dart
diff --git a/runtime/bin/stream_util.dart b/runtime/bin/stream_util.dart
index d558bfaabb37cd0838a0f348412058c02d930cd3..f00c4a2e54800d7d0089ffbfc7f19e67a0658108 100644
--- a/runtime/bin/stream_util.dart
+++ b/runtime/bin/stream_util.dart
@@ -175,3 +175,15 @@ void _pipe(InputStream input, OutputStream output, [bool close]) {
output.onNoPendingWrites = null;
}
+
+class _BaseOutputStream {
+ bool writeString(String string, [Encoding encoding = Encoding.UTF_8]) {
+ if (string.length > 0) {
+ // Encode and write data.
+ StringEncoder encoder = _StringEncoders.encoder(encoding);
+ List<int> data = encoder.encodeString(string);
+ return write(data, copyBuffer: false);
+ }
+ return true;
+ }
+}
« no previous file with comments | « runtime/bin/socket_stream_impl.dart ('k') | runtime/bin/string_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698