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

Side by Side Diff: test/generated_sdk/lib/convert/json.dart

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 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
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.convert; 5 part of dart.convert;
6 6
7 /** 7 /**
8 * Error thrown by JSON serialization if an object cannot be serialized. 8 * Error thrown by JSON serialization if an object cannot be serialized.
9 * 9 *
10 * The [unsupportedObject] field holds that object that failed to be serialized. 10 * The [unsupportedObject] field holds that object that failed to be serialized.
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 * The JSON text is UTF-8 encoded and written to [Uint8List] buffers. 883 * The JSON text is UTF-8 encoded and written to [Uint8List] buffers.
884 * The buffers are then passed back to a user provided callback method. 884 * The buffers are then passed back to a user provided callback method.
885 */ 885 */
886 class _JsonUtf8Stringifier extends _JsonStringifier { 886 class _JsonUtf8Stringifier extends _JsonStringifier {
887 final int bufferSize; 887 final int bufferSize;
888 final Function addChunk; 888 final Function addChunk;
889 Uint8List buffer; 889 Uint8List buffer;
890 int index = 0; 890 int index = 0;
891 891
892 _JsonUtf8Stringifier(toEncodable, int bufferSize, this.addChunk) 892 _JsonUtf8Stringifier(toEncodable, int bufferSize, this.addChunk)
893 : super(toEncodable), 893 : this.bufferSize = bufferSize,
894 this.bufferSize = bufferSize, 894 buffer = new Uint8List(bufferSize),
895 buffer = new Uint8List(bufferSize); 895 super(toEncodable)
896 ;
896 897
897 /** 898 /**
898 * Convert [object] to UTF-8 encoded JSON. 899 * Convert [object] to UTF-8 encoded JSON.
899 * 900 *
900 * Calls [addChunk] with slices of UTF-8 code units. 901 * Calls [addChunk] with slices of UTF-8 code units.
901 * These will typically have size [bufferSize], but may be shorter. 902 * These will typically have size [bufferSize], but may be shorter.
902 * The buffers are not reused, so the [addChunk] call may keep and reuse 903 * The buffers are not reused, so the [addChunk] call may keep and reuse
903 * the chunks. 904 * the chunks.
904 * 905 *
905 * If [indent] is non-`null`, the result will be "pretty-printed" with 906 * If [indent] is non-`null`, the result will be "pretty-printed" with
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 buffer.setRange(index, end, indent); 1049 buffer.setRange(index, end, indent);
1049 index = end; 1050 index = end;
1050 } else { 1051 } else {
1051 for (int i = 0; i < indentLength; i++) { 1052 for (int i = 0; i < indentLength; i++) {
1052 writeByte(indent[i]); 1053 writeByte(indent[i]);
1053 } 1054 }
1054 } 1055 }
1055 } 1056 }
1056 } 1057 }
1057 } 1058 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698