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

Unified Diff: runtime/bin/file_impl.dart

Issue 8413034: New OutputStream interface (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 years, 2 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/file.dart ('k') | runtime/bin/output_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_impl.dart
diff --git a/runtime/bin/file_impl.dart b/runtime/bin/file_impl.dart
index 4533633e7556d92159ff51e0565b4b2c5f706d23..38bfadd18e581cc3fb16f143e75a339eef50afca 100644
--- a/runtime/bin/file_impl.dart
+++ b/runtime/bin/file_impl.dart
@@ -73,9 +73,36 @@ class _FileOutputStream implements FileOutputStream {
_file.openSync(true);
}
- bool write(List<int> buffer, int offset, int len, void callback()) {
- int bytesWritten = _file.writeListSync(buffer, offset, len);
+ bool write(List<int> buffer) {
+ return _write(buffer, 0, buffer.length);
+ }
+
+ bool writeFrom(List<int> buffer, [int offset, int len]) {
+ return _write(buffer, offset, (len == null) ? buffer.length : len);
+ }
+
+ void end() {
+ _file.closeSync();
+ }
+
+ void close() {
+ _file.closeSync();
+ }
+
+ void set noPendingWriteHandler(void callback()) {
+ // TODO(sgjesse): How to handle this?
+ }
+ void set closeHandler(void callback()) {
+ // TODO(sgjesse): How to handle this?
+ }
+
+ void set errorHandler(void callback()) {
+ // TODO(sgjesse): How to handle this?
+ }
+
+ bool _write(List<int> buffer, int offset, int len) {
+ int bytesWritten = _file.writeListSync(buffer, offset, len);
if (bytesWritten == len) {
return true;
} else {
@@ -83,10 +110,6 @@ class _FileOutputStream implements FileOutputStream {
}
}
- void close() {
- _file.closeSync();
- }
-
File _file;
}
« no previous file with comments | « runtime/bin/file.dart ('k') | runtime/bin/output_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698