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

Side by Side Diff: sdk/lib/io/file_system_entity.dart

Issue 159713011: class-level docs for several dart:io classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge with master Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/platform.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) 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 /**
8 * The type of an entity on the file system, such as a file, directory, or link.
9 *
10 * These constants are used by the [FileSystemEntity] class
11 * to indicate the object's type.
12 *
13 */
14
7 class FileSystemEntityType { 15 class FileSystemEntityType {
8 static const FILE = const FileSystemEntityType._internal(0); 16 static const FILE = const FileSystemEntityType._internal(0);
9 static const DIRECTORY = const FileSystemEntityType._internal(1); 17 static const DIRECTORY = const FileSystemEntityType._internal(1);
10 static const LINK = const FileSystemEntityType._internal(2); 18 static const LINK = const FileSystemEntityType._internal(2);
11 static const NOT_FOUND = const FileSystemEntityType._internal(3); 19 static const NOT_FOUND = const FileSystemEntityType._internal(3);
12 static const _typeList = const [FileSystemEntityType.FILE, 20 static const _typeList = const [FileSystemEntityType.FILE,
13 FileSystemEntityType.DIRECTORY, 21 FileSystemEntityType.DIRECTORY,
14 FileSystemEntityType.LINK, 22 FileSystemEntityType.LINK,
15 FileSystemEntityType.NOT_FOUND]; 23 FileSystemEntityType.NOT_FOUND];
16 final int _type; 24 final int _type;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 result 165 result
158 ..add(codes[(permissions >> 6) & 0x7]) 166 ..add(codes[(permissions >> 6) & 0x7])
159 ..add(codes[(permissions >> 3) & 0x7]) 167 ..add(codes[(permissions >> 3) & 0x7])
160 ..add(codes[permissions & 0x7]); 168 ..add(codes[permissions & 0x7]);
161 return result.join(); 169 return result.join();
162 } 170 }
163 } 171 }
164 172
165 173
166 /** 174 /**
167 * A [FileSystemEntity] is a common super class for [File] and 175 * The common super class for [File], [Directory], and [Link] objects.
168 * [Directory] objects.
169 * 176 *
170 * [FileSystemEntity] objects are returned from directory listing 177 * [FileSystemEntity] objects are returned from directory listing
171 * operations. To determine if a FileSystemEntity is a [File] or a 178 * operations. To determine if a FileSystemEntity is a [File], a
172 * [Directory], perform a type check: 179 * [Directory], or a [Link] perform a type check:
173 * 180 *
174 * if (entity is File) (entity as File).readAsStringSync(); 181 * if (entity is File) (entity as File).readAsStringSync();
182 *
183 * You can also use the [type] or [typeSync] methods to determine
184 * the type of a file system object.
185 *
186 * Most methods in this class occur in synchronous and asynchronous pairs,
187 * for example, [exists] and [existsSync].
188 * Unless you have a specific reason for using the synchronous version
189 * of a method, prefer the asynchronous version to avoid blocking your program.
190 *
191 * Here's the exists method in action:
192 *
193 * entity.exists().then((isThere) {
194 * isThere ? print('exists') : print('non-existent');
195 * });
196 *
197 *
198 * ## Other resources
199 *
200 * [Dart by Example](https://www.dartlang.org/dart-by-example/#files-directories -and-symlinks)
201 * provides additional task-oriented code samples that show how to use
202 * various API from the [Directory] class and the [File] class,
203 * both subclasses of FileSystemEntity.
204 *
205 * * [I/O for Command-Line Apps](https://www.dartlang.org/docs/dart-up-and-runni ng/contents/ch03.html#ch03-dartio---file-and-socket-io-for-command-line-apps)
206 * a section from _A Tour of the Dart Libraries_
207 * covers files and directories.
208 *
209 * * [Write Command-Line Apps](https://www.dartlang.org/docs/tutorials/cmdline/) ,
210 * a tutorial about writing command-line apps, includes information
211 * about files and directories.
212
175 */ 213 */
176 abstract class FileSystemEntity { 214 abstract class FileSystemEntity {
177 String get path; 215 String get path;
178 216
179 /** 217 /**
180 * Checks whether the file system entity with this path exists. Returns 218 * Checks whether the file system entity with this path exists. Returns
181 * a [:Future<bool>:] that completes with the result. 219 * a [:Future<bool>:] that completes with the result.
182 * 220 *
183 * Since FileSystemEntity is abstract, every FileSystemEntity object 221 * Since FileSystemEntity is abstract, every FileSystemEntity object
184 * is actually an instance of one of the subclasses [File], 222 * is actually an instance of one of the subclasses [File],
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 return buffer.toString(); 806 return buffer.toString();
769 } 807 }
770 } 808 }
771 809
772 810
773 class _FileSystemWatcher { 811 class _FileSystemWatcher {
774 external static Stream<FileSystemEvent> watch( 812 external static Stream<FileSystemEvent> watch(
775 String path, int events, bool recursive); 813 String path, int events, bool recursive);
776 external static bool get isSupported; 814 external static bool get isSupported;
777 } 815 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698