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

Side by Side Diff: pkg/analyzer/lib/file_system/physical_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
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 physical_file_system; 5 library physical_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/src/generated/java_io.dart'; 10 import 'package:analyzer/src/generated/java_io.dart';
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (uri == null) { 91 if (uri == null) {
92 uri = javaFile.toURI(); 92 uri = javaFile.toURI();
93 } 93 }
94 return new FileBasedSource.con2(uri, javaFile); 94 return new FileBasedSource.con2(uri, javaFile);
95 } 95 }
96 96
97 @override 97 @override
98 bool isOrContains(String path) { 98 bool isOrContains(String path) {
99 return path == this.path; 99 return path == this.path;
100 } 100 }
101
102 @override
103 String readAsStringSync() {
104 try {
105 io.File file = _entry as io.File;
106 return file.readAsStringSync();
107 } on io.FileSystemException catch (exception) {
108 throw new FileSystemException(exception.path, exception.message);
109 }
110 }
101 } 111 }
102 112
103 /** 113 /**
104 * A `dart:io` based implementation of [Folder]. 114 * A `dart:io` based implementation of [Folder].
105 */ 115 */
106 class _PhysicalFolder extends _PhysicalResource implements Folder { 116 class _PhysicalFolder extends _PhysicalResource implements Folder {
107 _PhysicalFolder(io.Directory directory) : super(directory); 117 _PhysicalFolder(io.Directory directory) : super(directory);
108 118
109 @override 119 @override
110 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; 120 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bool operator ==(other) { 205 bool operator ==(other) {
196 if (runtimeType != other.runtimeType) { 206 if (runtimeType != other.runtimeType) {
197 return false; 207 return false;
198 } 208 }
199 return path == other.path; 209 return path == other.path;
200 } 210 }
201 211
202 @override 212 @override
203 String toString() => path; 213 String toString() => path;
204 } 214 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/memory_file_system.dart ('k') | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698