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

Unified Diff: sdk/lib/io/stdio.dart

Issue 2761673002: [dart:io][windows] Use WriteFile instead of _write (Closed)
Patch Set: Format stdio.dart Created 3 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 | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/stdio.dart
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart
index 8f1c6256dccb045ebeabd949205f05421b1dd09e..7bc5bd677b94ec2eb8161324e3c6e7d234e8fce3 100644
--- a/sdk/lib/io/stdio.dart
+++ b/sdk/lib/io/stdio.dart
@@ -183,7 +183,7 @@ class Stdin extends _StdStream implements Stream<List<int>> {
* This class can also be used to check whether `stdout` or `stderr` is
* connected to a terminal and query some terminal properties.
*/
-class Stdout extends _StdFileSink implements IOSink {
+class Stdout extends _StdSink implements IOSink {
final int _fd;
IOSink _nonBlocking;
@@ -300,42 +300,30 @@ class _StdConsumer implements StreamConsumer<List<int>> {
}
}
-class _StdSinkHelper implements IOSink {
+class _StdSink implements IOSink {
final IOSink _sink;
final bool _isTranslatable;
- _StdSinkHelper(this._sink, this._isTranslatable);
+ _StdSink(this._sink);
Encoding get encoding => _sink.encoding;
void set encoding(Encoding encoding) {
_sink.encoding = encoding;
}
- void set _translation(_FileTranslation t) {
- if (_isTranslatable) {
- _IOSinkImpl sink = _sink;
- _StdConsumer target = sink._target;
- target._file.translation = t;
- }
- }
-
void write(object) {
- _translation = _FileTranslation.text;
_sink.write(object);
}
void writeln([object = ""]) {
- _translation = _FileTranslation.text;
_sink.writeln(object);
}
void writeAll(objects, [sep = ""]) {
- _translation = _FileTranslation.text;
_sink.writeAll(objects, sep);
}
void add(List<int> data) {
- _translation = _FileTranslation.binary;
_sink.add(data);
}
@@ -344,29 +332,15 @@ class _StdSinkHelper implements IOSink {
}
void writeCharCode(int charCode) {
- _translation = _FileTranslation.text;
_sink.writeCharCode(charCode);
}
- Future addStream(Stream<List<int>> stream) {
- _translation = _FileTranslation.binary;
- return _sink.addStream(stream);
- }
-
+ Future addStream(Stream<List<int>> stream) => _sink.addStream(stream);
Future flush() => _sink.flush();
Future close() => _sink.close();
Future get done => _sink.done;
}
-class _StdFileSink extends _StdSinkHelper {
- // The target of `sink` is expected to be a _StdConsumer.
- _StdFileSink(IOSink sink) : super(sink, true);
-}
-
-class _StdSocketSink extends _StdSinkHelper {
- _StdSocketSink(IOSink sink) : super(sink, false);
-}
-
/// The type of object a standard IO stream is attached to.
class StdioType {
static const StdioType TERMINAL = const StdioType._("terminal");
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698