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

Side by Side Diff: pkg/analyzer/lib/file_system/file_system.dart

Issue 1007233002: Add readAsStringSync() to File. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | « no previous file | pkg/analyzer/lib/file_system/memory_file_system.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 file_system; 5 library file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:path/path.dart'; 10 import 'package:path/path.dart';
11 import 'package:watcher/watcher.dart'; 11 import 'package:watcher/watcher.dart';
12 12
13 /** 13 /**
14 * [File]s are leaf [Resource]s which contain data. 14 * [File]s are leaf [Resource]s which contain data.
15 */ 15 */
16 abstract class File extends Resource { 16 abstract class File extends Resource {
17 /** 17 /**
18 * Return the last-modified stamp of the file. 18 * Return the last-modified stamp of the file.
19 * Throws [FileSystemException] if the file does not exist. 19 * Throws [FileSystemException] if the file does not exist.
20 */ 20 */
21 int get modificationStamp; 21 int get modificationStamp;
22 22
23 /** 23 /**
24 * Create a new [Source] instance that serves this file. 24 * Create a new [Source] instance that serves this file.
25 */ 25 */
26 Source createSource([Uri uri]); 26 Source createSource([Uri uri]);
27
28 /**
29 * Synchronously read the entire file contents as a [String].
30 * Throws [FileSystemException] if the file does not exist.
31 */
32 String readAsStringSync();
27 } 33 }
28 34
29 /** 35 /**
30 * Base class for all file system exceptions. 36 * Base class for all file system exceptions.
31 */ 37 */
32 class FileSystemException implements Exception { 38 class FileSystemException implements Exception {
33 final String path; 39 final String path;
34 final String message; 40 final String message;
35 41
36 FileSystemException(this.path, this.message); 42 FileSystemException(this.path, this.message);
(...skipping 26 matching lines...) Expand all
63 */ 69 */
64 bool contains(String path); 70 bool contains(String path);
65 71
66 /** 72 /**
67 * Return an existing child [Resource] with the given [relPath]. 73 * Return an existing child [Resource] with the given [relPath].
68 * Return a not existing [File] if no such child exist. 74 * Return a not existing [File] if no such child exist.
69 */ 75 */
70 Resource getChild(String relPath); 76 Resource getChild(String relPath);
71 77
72 /** 78 /**
73 * Return a list of existing direct children [Resource]s (folders and files)
74 * in this folder, in no particular order.
75 */
76 List<Resource> getChildren();
77
78 /**
79 * Return a [Folder] representing a child [Resource] with the given 79 * Return a [Folder] representing a child [Resource] with the given
80 * [relPath]. This call does not check whether a folder with the given name 80 * [relPath]. This call does not check whether a folder with the given name
81 * exists on the filesystem--client must call the [Folder]'s `exists` getter 81 * exists on the filesystem--client must call the [Folder]'s `exists` getter
82 * to determine whether the folder actually exists. 82 * to determine whether the folder actually exists.
83 */ 83 */
84 Folder getChildAssumingFolder(String relPath); 84 Folder getChildAssumingFolder(String relPath);
85
86 /**
87 * Return a list of existing direct children [Resource]s (folders and files)
88 * in this folder, in no particular order.
89 */
90 List<Resource> getChildren();
85 } 91 }
86 92
87 /** 93 /**
88 * The abstract class [Resource] is an abstraction of file or folder. 94 * The abstract class [Resource] is an abstraction of file or folder.
89 */ 95 */
90 abstract class Resource { 96 abstract class Resource {
91 /** 97 /**
92 * Return `true` if this resource exists. 98 * Return `true` if this resource exists.
93 */ 99 */
94 bool get exists; 100 bool get exists;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 Uri restoreAbsolute(Source source) => source.uri; 178 Uri restoreAbsolute(Source source) => source.uri;
173 179
174 /** 180 /**
175 * Return `true` if the given URI is a `file` URI. 181 * Return `true` if the given URI is a `file` URI.
176 * 182 *
177 * @param uri the URI being tested 183 * @param uri the URI being tested
178 * @return `true` if the given URI is a `file` URI 184 * @return `true` if the given URI is a `file` URI
179 */ 185 */
180 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; 186 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME;
181 } 187 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/file_system/memory_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698