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

Side by Side Diff: runtime/bin/file.dart

Issue 8431028: Implement async file API on top of isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type mismatch. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 interface File factory _File { 5 interface File factory _File {
6 /** 6 /**
7 * Create a File object. 7 * Create a File object.
8 */ 8 */
9 File(String name); 9 File(String name);
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int readListSync(List<int> buffer, int offset, int bytes); 81 int readListSync(List<int> buffer, int offset, int bytes);
82 82
83 /** 83 /**
84 * Write a single byte to the file. If the byte cannot be written 84 * Write a single byte to the file. If the byte cannot be written
85 * the [errorHandler] is called. When all pending write operations 85 * the [errorHandler] is called. When all pending write operations
86 * have finished the [noPendingWriteHandler] is called. 86 * have finished the [noPendingWriteHandler] is called.
87 */ 87 */
88 void writeByte(int value); 88 void writeByte(int value);
89 89
90 /** 90 /**
91 * Synchronously write a single byte to the file. Returns true if 91 * Synchronously write a single byte to the file. Returns the
92 * the byte was successfully written and false otherwise. 92 * number of bytes successfully written.
93 */ 93 */
94 bool writeByteSync(int value); 94 int writeByteSync(int value);
95 95
96 /** 96 /**
97 * Write a List<int> to the file. If the list cannot be written the 97 * Write a List<int> to the file. If the list cannot be written the
98 * [errorHandler] is called. When all pending write operations have 98 * [errorHandler] is called. When all pending write operations have
99 * finished the [noPendingWriteHandler] is called. 99 * finished the [noPendingWriteHandler] is called.
100 */ 100 */
101 void writeList(List<int> buffer, int offset, int bytes); 101 void writeList(List<int> buffer, int offset, int bytes);
102 102
103 /** 103 /**
104 * Synchronously write a List<int> to the file. Returns true if the 104 * Synchronously write a List<int> to the file. Returns the number
105 * list was successfully written and false otherwise. 105 * of bytes successfully written.
106 */ 106 */
107 bool writeListSync(List<int> buffer, int offset, int bytes); 107 int writeListSync(List<int> buffer, int offset, int bytes);
108 108
109 /** 109 /**
110 * Write a string to the file. If the string cannot be written the 110 * Write a string to the file. If the string cannot be written the
111 * [errorHandler] is called. When all pending write operations have 111 * [errorHandler] is called. When all pending write operations have
112 * finished the [noPendingWriteHandler] is called. 112 * finished the [noPendingWriteHandler] is called.
113 */ 113 */
114 // TODO(ager): writeString should take an encoding. 114 // TODO(ager): writeString should take an encoding.
115 void writeString(String string); 115 void writeString(String string);
116 116
117 /** 117 /**
118 * Synchronously write a single string to the file. Returns true if 118 * Synchronously write a single string to the file. Returns the number
119 * the string was successfully written and false otherwise. 119 * of characters successfully written.
120 */ 120 */
121 // TODO(ager): writeStringSync should take an encoding. 121 // TODO(ager): writeStringSync should take an encoding.
122 bool writeStringSync(String string); 122 int writeStringSync(String string);
123 123
124 /** 124 /**
125 * Get the current position of the file. When the operation 125 * Get the current position of the file. When the operation
126 * completes the [positionHandler] is called with the position. 126 * completes the [positionHandler] is called with the position.
127 */ 127 */
128 void position(); 128 void position();
129 129
130 /** 130 /**
131 * Synchronously get the current position of the file. 131 * Synchronously get the current position of the file.
132 */ 132 */
133 int positionSync(); 133 int positionSync();
134 134
135 /** 135 /**
136 * Get the length of the file. When the operation completes the 136 * Get the length of the file. When the operation completes the
137 * [lengthHandler] is called with the length. 137 * [lengthHandler] is called with the length.
138 */ 138 */
139 void length(); 139 void length();
140 140
141 /** 141 /**
142 * Get the length of the file. When the operation completes the 142 * Get the length of the file. When the operation completes the
143 * [lengthHandler] is called with the length. 143 * [lengthHandler] is called with the length.
144 */ 144 */
145 int lengthSync(); 145 int lengthSync();
146 146
147 /** 147 /**
148 * Flush the contents of the file to disk. If there are no pending 148 * Flush the contents of the file to disk. The [flushHandler] is
149 * write operation after the flush operation completes, the 149 * called when the flush operation completes.
150 * [noPendingWriteHandler] is called.
151 */ 150 */
152 void flush(); 151 void flush();
153 152
154 /** 153 /**
155 * Synchronously flush the contents of the file to disk. 154 * Synchronously flush the contents of the file to disk.
156 */ 155 */
157 void flushSync(); 156 void flushSync();
158 157
159 /** 158 /**
160 * Create a new independent input stream for the file. The file 159 * Create a new independent input stream for the file. The file
(...skipping 13 matching lines...) Expand all
174 String get name(); 173 String get name();
175 174
176 // Event handlers. 175 // Event handlers.
177 void set existsHandler(void handler(bool exists)); 176 void set existsHandler(void handler(bool exists));
178 void set createHandler(void handler()); 177 void set createHandler(void handler());
179 void set openHandler(void handler()); 178 void set openHandler(void handler());
180 void set closeHandler(void handler()); 179 void set closeHandler(void handler());
181 void set readByteHandler(void handler(int byte)); 180 void set readByteHandler(void handler(int byte));
182 void set readListHandler(void handler(int read)); 181 void set readListHandler(void handler(int read));
183 void set noPendingWriteHandler(void handler()); 182 void set noPendingWriteHandler(void handler());
183 void set positionHandler(void handler(int position));
184 void set lengthHandler(void handler(int length));
185 void set flushHandler(void handler());
184 void set errorHandler(void handler(String error)); 186 void set errorHandler(void handler(String error));
185 } 187 }
186 188
187 189
188 interface FileInputStream extends InputStream { 190 interface FileInputStream extends InputStream {
189 void close(); 191 void close();
190 } 192 }
191 193
192 194
193 interface FileOutputStream extends OutputStream { 195 interface FileOutputStream extends OutputStream {
194 } 196 }
195 197
196 198
197 class FileIOException implements Exception { 199 class FileIOException implements Exception {
198 const FileIOException([String this.message = ""]); 200 const FileIOException([String this.message = ""]);
199 String toString() => "FileIOException: $message"; 201 String toString() => "FileIOException: $message";
200 final String message; 202 final String message;
201 } 203 }
OLDNEW
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698