OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library front_end.file_system; | 5 library front_end.file_system; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 /// Abstract interface to file system operations. | 9 /// Abstract interface to file system operations. |
10 /// | 10 /// |
(...skipping 24 matching lines...) Expand all Loading... |
35 abstract class FileSystemEntity { | 35 abstract class FileSystemEntity { |
36 /// The absolute normalized URI represented by this file system entity. | 36 /// The absolute normalized URI represented by this file system entity. |
37 /// | 37 /// |
38 /// Note: this is not necessarily the same as the URI that was passed to | 38 /// Note: this is not necessarily the same as the URI that was passed to |
39 /// [FileSystem.entityForUri], since the URI might have been normalized. | 39 /// [FileSystem.entityForUri], since the URI might have been normalized. |
40 Uri get uri; | 40 Uri get uri; |
41 | 41 |
42 /// Whether this file system entity exists. | 42 /// Whether this file system entity exists. |
43 Future<bool> exists(); | 43 Future<bool> exists(); |
44 | 44 |
45 /// Extracts the last-modification time of the file system entity, if it | |
46 /// exists and it is a file, otherwise the future is completed with | |
47 /// [FileSystemException]. | |
48 Future<DateTime> lastModified(); | |
49 | |
50 /// Attempts to access this file system entity as a file and read its contents | 45 /// Attempts to access this file system entity as a file and read its contents |
51 /// as raw bytes. | 46 /// as raw bytes. |
52 /// | 47 /// |
53 /// If an error occurs while attempting to read the file (e.g. because no such | 48 /// If an error occurs while attempting to read the file (e.g. because no such |
54 /// file exists, or the entity is a directory), the future is completed with | 49 /// file exists, or the entity is a directory), the future is completed with |
55 /// [FileSystemException]. | 50 /// [FileSystemException]. |
56 Future<List<int>> readAsBytes(); | 51 Future<List<int>> readAsBytes(); |
57 | 52 |
58 /// Attempts to access this file system entity as a file and read its contents | 53 /// Attempts to access this file system entity as a file and read its contents |
59 /// as a string. | 54 /// as a string. |
(...skipping 11 matching lines...) Expand all Loading... |
71 */ | 66 */ |
72 class FileSystemException implements Exception { | 67 class FileSystemException implements Exception { |
73 final Uri uri; | 68 final Uri uri; |
74 final String message; | 69 final String message; |
75 | 70 |
76 FileSystemException(this.uri, this.message); | 71 FileSystemException(this.uri, this.message); |
77 | 72 |
78 @override | 73 @override |
79 String toString() => 'FileSystemException(uri=$uri; message=$message)'; | 74 String toString() => 'FileSystemException(uri=$uri; message=$message)'; |
80 } | 75 } |
OLD | NEW |