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

Side by Side Diff: sdk/lib/io/stdio.dart

Issue 2655883002: fix spelling in core libraries (Closed)
Patch Set: while I’m at it… Created 3 years, 10 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 | « sdk/lib/io/platform_impl.dart ('k') | sdk/lib/isolate/isolate.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) 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.io; 5 part of dart.io;
6 6
7 const int _STDIO_HANDLE_TYPE_TERMINAL = 0; 7 const int _STDIO_HANDLE_TYPE_TERMINAL = 0;
8 const int _STDIO_HANDLE_TYPE_PIPE = 1; 8 const int _STDIO_HANDLE_TYPE_PIPE = 1;
9 const int _STDIO_HANDLE_TYPE_FILE = 2; 9 const int _STDIO_HANDLE_TYPE_FILE = 2;
10 const int _STDIO_HANDLE_TYPE_SOCKET = 3; 10 const int _STDIO_HANDLE_TYPE_SOCKET = 3;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 * 44 *
45 * The argument [encoding] can be used to changed how the input should be 45 * The argument [encoding] can be used to changed how the input should be
46 * decoded. Default is [SYSTEM_ENCODING]. 46 * decoded. Default is [SYSTEM_ENCODING].
47 * 47 *
48 * If [retainNewlines] is `false`, the returned String will not contain the 48 * If [retainNewlines] is `false`, the returned String will not contain the
49 * final newline. If `true`, the returned String will contain the line 49 * final newline. If `true`, the returned String will contain the line
50 * terminator. Default is `false`. 50 * terminator. Default is `false`.
51 * 51 *
52 * If end-of-file is reached after any bytes have been read from stdin, 52 * If end-of-file is reached after any bytes have been read from stdin,
53 * that data is returned. 53 * that data is returned.
54 * Returns `null` if no bytes preceeded the end of input. 54 * Returns `null` if no bytes preceded the end of input.
55 */ 55 */
56 String readLineSync({Encoding encoding: SYSTEM_ENCODING, 56 String readLineSync({Encoding encoding: SYSTEM_ENCODING,
57 bool retainNewlines: false}) { 57 bool retainNewlines: false}) {
58 const CR = 13; 58 const CR = 13;
59 const LF = 10; 59 const LF = 10;
60 final List<int> line = <int>[]; 60 final List<int> line = <int>[];
61 // On Windows, if lineMode is disabled, only CR is received. 61 // On Windows, if lineMode is disabled, only CR is received.
62 bool crIsNewline = Platform.isWindows && 62 bool crIsNewline = Platform.isWindows &&
63 (stdioType(stdin) == StdioType.TERMINAL) && 63 (stdioType(stdin) == StdioType.TERMINAL) &&
64 !lineMode; 64 !lineMode;
(...skipping 14 matching lines...) Expand all
79 while (true) { 79 while (true) {
80 int byte = readByteSync(); 80 int byte = readByteSync();
81 if (byte < 0) { 81 if (byte < 0) {
82 if (line.isEmpty) return null; 82 if (line.isEmpty) return null;
83 break; 83 break;
84 } 84 }
85 if (byte == LF || byte == CR) break; 85 if (byte == LF || byte == CR) break;
86 line.add(byte); 86 line.add(byte);
87 } 87 }
88 } else { 88 } else {
89 // Case having to hande CR LF as a single unretained line terminator. 89 // Case having to handel CR LF as a single unretained line terminator.
90 outer: while (true) { 90 outer: while (true) {
91 int byte = readByteSync(); 91 int byte = readByteSync();
92 if (byte == LF) break; 92 if (byte == LF) break;
93 if (byte == CR) { 93 if (byte == CR) {
94 do { 94 do {
95 byte = readByteSync(); 95 byte = readByteSync();
96 if (byte == LF) break outer; 96 if (byte == LF) break outer;
97 97
98 line.add(CR); 98 line.add(CR);
99 } while (byte == CR); 99 } while (byte == CR);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 367
368 class _StdIOUtils { 368 class _StdIOUtils {
369 external static _getStdioOutputStream(int fd); 369 external static _getStdioOutputStream(int fd);
370 external static Stdin _getStdioInputStream(); 370 external static Stdin _getStdioInputStream();
371 /// Returns the socket type or `null` if [socket] is not a builtin socket. 371 /// Returns the socket type or `null` if [socket] is not a builtin socket.
372 external static int _socketType(Socket socket); 372 external static int _socketType(Socket socket);
373 external static _getStdioHandleType(int fd); 373 external static _getStdioHandleType(int fd);
374 } 374 }
OLDNEW
« no previous file with comments | « sdk/lib/io/platform_impl.dart ('k') | sdk/lib/isolate/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698