OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * FileMode describes the modes in which a file can be opened. | 8 * FileMode describes the modes in which a file can be opened. |
9 */ | 9 */ |
10 class FileMode { | 10 class FileMode { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 Future<String> fullPath(); | 173 Future<String> fullPath(); |
174 | 174 |
175 /** | 175 /** |
176 * Synchronously get the canonical full path corresponding to the file path. | 176 * Synchronously get the canonical full path corresponding to the file path. |
177 * | 177 * |
178 * Throws a [FileIOException] if the operation fails. | 178 * Throws a [FileIOException] if the operation fails. |
179 */ | 179 */ |
180 String fullPathSync(); | 180 String fullPathSync(); |
181 | 181 |
182 /** | 182 /** |
183 * Create a new independent [Stream](../dart_async/Stream.html) for the | 183 * Create a new independent [Stream] for the contents of this file. |
184 * contents of this file. | 184 * |
| 185 * If [start] is present, the file will be read from byte-offset [start]. |
| 186 * Otherwise from the beginning (index 0). |
| 187 * |
| 188 * If [end] is present, only up to byte-index [end] will be read. Otherwise, |
| 189 * until end of file. |
185 * | 190 * |
186 * In order to make sure that system resources are freed, the stream | 191 * In order to make sure that system resources are freed, the stream |
187 * must be read to completion or the subscription on the stream must | 192 * must be read to completion or the subscription on the stream must |
188 * be cancelled. | 193 * be cancelled. |
189 */ | 194 */ |
190 Stream<List<int>> openRead(); | 195 Stream<List<int>> openRead([int start, int end]); |
191 | 196 |
192 /** | 197 /** |
193 * Creates a new independent [IOSink] for the file. The | 198 * Creates a new independent [IOSink] for the file. The |
194 * [IOSink] must be closed when no longer used, to free | 199 * [IOSink] must be closed when no longer used, to free |
195 * system resources. | 200 * system resources. |
196 * | 201 * |
197 * An [IOSink] for a file can be opened in two modes: | 202 * An [IOSink] for a file can be opened in two modes: |
198 * | 203 * |
199 * * [FileMode.WRITE]: truncates the file to length zero. | 204 * * [FileMode.WRITE]: truncates the file to length zero. |
200 * * [FileMode.APPEND]: sets the initial write position to the end | 205 * * [FileMode.APPEND]: sets the initial write position to the end |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 sb.write(" ($osError)"); | 538 sb.write(" ($osError)"); |
534 } | 539 } |
535 } else if (osError != null) { | 540 } else if (osError != null) { |
536 sb.write(": osError"); | 541 sb.write(": osError"); |
537 } | 542 } |
538 return sb.toString(); | 543 return sb.toString(); |
539 } | 544 } |
540 final String message; | 545 final String message; |
541 final OSError osError; | 546 final OSError osError; |
542 } | 547 } |
OLD | NEW |