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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart

Issue 2443013002: Update the API documentations with Paul review comments. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'package:analyzer/file_system/file_system.dart'; 5 import 'package:analyzer/file_system/file_system.dart';
6 import 'package:analyzer/src/dart/analysis/byte_store.dart'; 6 import 'package:analyzer/src/dart/analysis/byte_store.dart';
7 7
8 /** 8 /**
9 * [ByteStore] that stores values as [File]s. 9 * [ByteStore] that stores values as [File]s.
10 *
11 * TODO(scheglov) Add some eviction policies.
10 */ 12 */
11 class FileByteStore implements ByteStore { 13 class FileByteStore implements ByteStore {
12 final Folder folder; 14 final Folder folder;
13 15
14 FileByteStore(this.folder); 16 FileByteStore(this.folder);
15 17
16 @override 18 @override
17 List<int> get(String key) { 19 List<int> get(String key) {
18 try { 20 try {
19 File file = folder.getChildAssumingFile(key); 21 File file = folder.getChildAssumingFile(key);
20 return file.readAsBytesSync(); 22 return file.readAsBytesSync();
21 } catch (_) { 23 } catch (_) {
22 return null; 24 return null;
23 } 25 }
24 } 26 }
25 27
26 @override 28 @override
27 void put(String key, List<int> bytes) { 29 void put(String key, List<int> bytes) {
28 try { 30 try {
29 File file = folder.getChildAssumingFile(key); 31 File file = folder.getChildAssumingFile(key);
30 file.writeAsBytesSync(bytes); 32 file.writeAsBytesSync(bytes);
31 } catch (_) {} 33 } catch (_) {}
32 } 34 }
33 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698