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

Unified Diff: runtime/bin/input_stream.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/http_impl.dart ('k') | runtime/bin/list_stream_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/input_stream.dart
diff --git a/runtime/bin/input_stream.dart b/runtime/bin/input_stream.dart
index 772c7dcbace6318e2d11a6954e31193b858a1ede..026ddc13d0aeb0396e5bb11e93c65fdc980db532 100644
--- a/runtime/bin/input_stream.dart
+++ b/runtime/bin/input_stream.dart
@@ -100,6 +100,19 @@ interface InputStream {
/**
+ * String encodings supported by [StringInputStream] and
+ * [StringOutputStream].
+ */
+class Encoding {
+ static final Encoding UTF_8 = const Encoding("UTF-8");
+ static final Encoding ISO_8859_1 = const Encoding("ISO-8859-1");
+ static final Encoding ASCII = const Encoding("ASCII");
+ const Encoding(String this.name);
+ final String name;
+}
+
+
+/**
* A string input stream wraps a basic input stream and supplies
* string data. This data can be read either as string chunks or as
* lines separated by line termination character sequences.
@@ -107,9 +120,9 @@ interface InputStream {
interface StringInputStream default _StringInputStream {
/**
* Decodes a binary input stream into characters using the specified
- * encoding.
+ * encoding. The default encoding is UTF-8 - [:Encoding.UTF_8:].
*/
- StringInputStream(InputStream input, [String encoding]);
+ StringInputStream(InputStream input, [Encoding encoding]);
/**
* Reads as many characters as is available from the stream. If no data is
@@ -143,7 +156,7 @@ interface StringInputStream default _StringInputStream {
/**
* Returns the encoding used to decode the binary data into characters.
*/
- String get encoding();
+ Encoding get encoding();
/**
* Sets the handler that gets called when data is available. The two
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | runtime/bin/list_stream_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698