Index: sdk/lib/io/file_system_entity.dart |
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart |
index 9a657a1ebc27ace64861815e668151c25e19d099..4b8950f461979d9f3599cafcf431bbfec1e78d75 100644 |
--- a/sdk/lib/io/file_system_entity.dart |
+++ b/sdk/lib/io/file_system_entity.dart |
@@ -4,6 +4,14 @@ |
part of dart.io; |
+/** |
+ * The type of an entity on the file system, such as a file, directory, or link. |
+ * |
+ * These constants are used by the [FileSystemEntity] class |
+ * to indicate the object's type. |
+ * |
+ */ |
+ |
class FileSystemEntityType { |
static const FILE = const FileSystemEntityType._internal(0); |
static const DIRECTORY = const FileSystemEntityType._internal(1); |
@@ -164,14 +172,44 @@ FileStat: type $type |
/** |
- * A [FileSystemEntity] is a common super class for [File] and |
- * [Directory] objects. |
+ * The common super class for [File], [Directory], and [Link] objects. |
* |
* [FileSystemEntity] objects are returned from directory listing |
- * operations. To determine if a FileSystemEntity is a [File] or a |
- * [Directory], perform a type check: |
+ * operations. To determine if a FileSystemEntity is a [File], a |
+ * [Directory], or a [Link] perform a type check: |
* |
* if (entity is File) (entity as File).readAsStringSync(); |
+ * |
+ * You can also use the [type] or [typeSync] methods to determine |
+ * the type of a file system object. |
+ * |
+ * Most methods in this class occur in synchronous and asynchronous pairs, |
+ * for example, [exists] and [existsSync]. |
+ * Unless you have a specific reason for using the synchronous version |
+ * of a method, prefer the asynchronous version to avoid blocking your program. |
+ * |
+ * Here's the exists method in action: |
+ * |
+ * entity.exists().then((isThere) { |
+ * isThere ? print('exists') : print('non-existent'); |
+ * }); |
+ * |
+ * |
+ * ## Other resources |
+ * |
+ * [Dart by Example](https://www.dartlang.org/dart-by-example/#files-directories-and-symlinks) |
+ * provides additional task-oriented code samples that show how to use |
+ * various API from the [Directory] class and the [File] class, |
+ * both subclasses of FileSystemEntity. |
+ * |
+ * * [I/O for Command-Line Apps](https://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-dartio---file-and-socket-io-for-command-line-apps) |
+ * a section from _A Tour of the Dart Libraries_ |
+ * covers files and directories. |
+ * |
+ * * [Write Command-Line Apps](https://www.dartlang.org/docs/tutorials/cmdline/), |
+ * a tutorial about writing command-line apps, includes information |
+ * about files and directories. |
+ |
*/ |
abstract class FileSystemEntity { |
String get path; |