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

Unified Diff: runtime/bin/file_impl.dart

Issue 9487005: Move back to having File.open{Input,Output}Stream return the stream directly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « runtime/bin/file.dart ('k') | samples/actors/samples/sssp/sssp-util.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 c221784bf5da4b8093ebd27d3b7bc64de8e1f03f..e21fb88b68abbd84a37720bd8467c9750659bb61 100644
--- a/runtime/bin/file_impl.dart
+++ b/runtime/bin/file_impl.dart
@@ -514,42 +514,11 @@ class _File implements File {
return result;
}
- void openInputStream() {
- _asyncUsed = true;
- // Create a new file object to handle the opening of the file for
- // creating an input stream. Currently the file input stream uses
- // synchronous calls on the opened file so we need to open it
- // synchronously.
- new Timer((t) {
- if (_inputStreamHandler != null) {
- _inputStreamHandler(new _FileInputStream(_name));
- }
- }, 0);
- }
-
- InputStream openInputStreamSync() {
+ InputStream openInputStream() {
return new _FileInputStream(_name);
}
- void openOutputStream([FileMode mode = FileMode.WRITE]) {
- _asyncUsed = true;
- if (mode != FileMode.WRITE &&
- mode != FileMode.APPEND) {
- throw new FileIOException(
- "Wrong FileMode. Use FileMode.WRITE or FileMode.APPEND");
- }
- OutputStream stream = new _FileOutputStream(_name, mode);
- new Timer(
- (Timer ignore) {
- if (_outputStreamHandler != null) _outputStreamHandler(stream);
- }, 0);
- }
-
- OutputStream openOutputStreamSync([FileMode mode = FileMode.WRITE]) {
- if (_asyncUsed) {
- throw new FileIOException(
- "Mixed use of synchronous and asynchronous API");
- }
+ OutputStream openOutputStream([FileMode mode = FileMode.WRITE]) {
if (mode != FileMode.WRITE &&
mode != FileMode.APPEND) {
throw new FileIOException(
@@ -561,7 +530,7 @@ class _File implements File {
void readAsBytes() {
_asyncUsed = true;
var chunks = new _BufferList();
- var stream = openInputStreamSync();
+ var stream = openInputStream();
stream.closeHandler = () {
if (_readAsBytesHandler != null) {
_readAsBytesHandler(chunks.readBytes(chunks.length));
@@ -703,14 +672,6 @@ class _File implements File {
_openHandler = handler;
}
- void set inputStreamHandler(void handler(InputStream stream)) {
- _inputStreamHandler = handler;
- }
-
- void set outputStreamHandler(void handler(OutputStream stream)) {
- _outputStreamHandler = handler;
- }
-
void set readAsBytesHandler(void handler(List<int> bytes)) {
_readAsBytesHandler = handler;
}
@@ -747,8 +708,6 @@ class _File implements File {
Function _deleteHandler;
Function _directoryHandler;
Function _openHandler;
- Function _inputStreamHandler;
- Function _outputStreamHandler;
Function _readAsBytesHandler;
Function _readAsTextHandler;
Function _readAsLinesHandler;
« no previous file with comments | « runtime/bin/file.dart ('k') | samples/actors/samples/sssp/sssp-util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698