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

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

Issue 2265593002: Add writeAsStringSync (issue 27109) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Use UTF8 for conversion Created 4 years, 4 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
« 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 analyzer.file_system.file_system; 5 library analyzer.file_system.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:analyzer/src/util/absolute_path.dart'; 10 import 'package:analyzer/src/util/absolute_path.dart';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 * an exception is thrown. 52 * an exception is thrown.
53 */ 53 */
54 File renameSync(String newPath); 54 File renameSync(String newPath);
55 55
56 /** 56 /**
57 * Synchronously write a list of bytes to the file. 57 * Synchronously write a list of bytes to the file.
58 * 58 *
59 * Throws a [FileSystemException] if the operation fails. 59 * Throws a [FileSystemException] if the operation fails.
60 */ 60 */
61 void writeAsBytesSync(List<int> bytes); 61 void writeAsBytesSync(List<int> bytes);
62
63 /**
64 * Synchronously write a the given [content] to the file. The new content will
65 * replace any existing content.
66 *
67 * Throws a [FileSystemException] if the operation fails.
68 */
69 void writeAsStringSync(String content);
62 } 70 }
63 71
64 /** 72 /**
65 * Base class for all file system exceptions. 73 * Base class for all file system exceptions.
66 */ 74 */
67 class FileSystemException implements Exception { 75 class FileSystemException implements Exception {
68 final String path; 76 final String path;
69 final String message; 77 final String message;
70 78
71 FileSystemException(this.path, this.message); 79 FileSystemException(this.path, this.message);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 263
256 @override 264 @override
257 Uri restoreAbsolute(Source source) => 265 Uri restoreAbsolute(Source source) =>
258 _provider.pathContext.toUri(source.fullName); 266 _provider.pathContext.toUri(source.fullName);
259 267
260 /** 268 /**
261 * Return `true` if the given [uri] is a `file` URI. 269 * Return `true` if the given [uri] is a `file` URI.
262 */ 270 */
263 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; 271 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
264 } 272 }
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