mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 04:01:29 +00:00
Switch from interfaces to abstract classes in dart:io.
Add a bunch of default argument values to the abstract classes so they are picked up by dartdoc. R=sgjesse@google.com BUG= Review URL: https://codereview.chromium.org//10938010 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12484 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
3a9fdcc250
commit
1159462fc6
|
@ -155,7 +155,7 @@ class Dartdoc {
|
|||
Path dartdocPath;
|
||||
|
||||
/** Path to generate HTML files into. */
|
||||
Path outputDir = const Path('docs');
|
||||
Path outputDir = new Path('docs');
|
||||
|
||||
/**
|
||||
* The title used for the overall generated output. Set this to change it.
|
||||
|
|
|
@ -3,11 +3,8 @@
|
|||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
class _ChunkedInputStream implements ChunkedInputStream {
|
||||
_ChunkedInputStream(InputStream this._input, [int chunkSize])
|
||||
: _chunkSize = chunkSize, _bufferList = new _BufferList() {
|
||||
if (_chunkSize === null) {
|
||||
_chunkSize = 0;
|
||||
}
|
||||
_ChunkedInputStream(InputStream this._input, int this._chunkSize)
|
||||
: _bufferList = new _BufferList() {
|
||||
_input.onClosed = _onClosed;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,26 +5,26 @@
|
|||
/**
|
||||
* [Directory] objects are used for working with directories.
|
||||
*/
|
||||
interface Directory default _Directory {
|
||||
abstract class Directory {
|
||||
/**
|
||||
* Creates a directory object. The path is either an absolute path,
|
||||
* or it is a relative path which is interpreted relative to the directory
|
||||
* in which the Dart VM was started.
|
||||
*/
|
||||
Directory(String path);
|
||||
factory Directory(String path) => new _Directory(path);
|
||||
|
||||
/**
|
||||
* Creates a directory object from a Path object. The path is either
|
||||
* an absolute path, or it is a relative path which is interpreted
|
||||
* relative to the directory in which the Dart VM was started.
|
||||
*/
|
||||
Directory.fromPath(Path path);
|
||||
factory Directory.fromPath(Path path) => new _Directory.fromPath(path);
|
||||
|
||||
/**
|
||||
* Creates a directory object pointing to the current working
|
||||
* directory.
|
||||
*/
|
||||
Directory.current();
|
||||
factory Directory.current() => new _Directory.current();
|
||||
|
||||
/**
|
||||
* Check whether a directory with this name already exists. Returns
|
||||
|
@ -126,7 +126,7 @@ interface Directory default _Directory {
|
|||
* operation. Handlers for files and directories should be
|
||||
* registered on this DirectoryLister object.
|
||||
*/
|
||||
DirectoryLister list([bool recursive]);
|
||||
DirectoryLister list([bool recursive = false]);
|
||||
|
||||
/**
|
||||
* Gets the path of this directory.
|
||||
|
@ -143,7 +143,7 @@ interface Directory default _Directory {
|
|||
* called. If the listing operation is recursive, the error handler is
|
||||
* called if a subdirectory cannot be opened for listing.
|
||||
*/
|
||||
interface DirectoryLister default _DirectoryLister {
|
||||
abstract class DirectoryLister {
|
||||
/**
|
||||
* Sets the directory handler that is called for all directories
|
||||
* during listing. The directory handler is called with the full
|
||||
|
|
|
@ -22,16 +22,16 @@ class FileMode {
|
|||
* streams using [openInputStream] and [openOutputStream] or open the
|
||||
* file for random access operations using [open].
|
||||
*/
|
||||
interface File default _File {
|
||||
abstract class File {
|
||||
/**
|
||||
* Create a File object.
|
||||
*/
|
||||
File(String name);
|
||||
factory File(String name) => new _File(name);
|
||||
|
||||
/**
|
||||
* Create a File object from a Path object.
|
||||
*/
|
||||
File.fromPath(Path path);
|
||||
factory File.fromPath(Path path) => new _File.fromPath(path);
|
||||
|
||||
/**
|
||||
* Check if the file exists. Does not block and returns a
|
||||
|
@ -125,10 +125,8 @@ interface File default _File {
|
|||
*
|
||||
* FileMode.APPEND: same as FileMode.WRITE except that the file is
|
||||
* not truncated.
|
||||
*
|
||||
* The default value for [mode] is [:FileMode.READ:].
|
||||
*/
|
||||
Future<RandomAccessFile> open([FileMode mode]);
|
||||
Future<RandomAccessFile> open([FileMode mode = FileMode.READ]);
|
||||
|
||||
/**
|
||||
* Synchronously open the file for random access operations. The
|
||||
|
@ -136,11 +134,9 @@ interface File default _File {
|
|||
* can be performed. Opened RandomAccessFiles must be closed using
|
||||
* the [close] method.
|
||||
*
|
||||
* The default value for [mode] is [:FileMode.READ:].
|
||||
*
|
||||
* See [open] for information on the [mode] argument.
|
||||
*/
|
||||
RandomAccessFile openSync([FileMode mode]);
|
||||
RandomAccessFile openSync([FileMode mode = FileMode.READ]);
|
||||
|
||||
/**
|
||||
* Get the canonical full path corresponding to the file name.
|
||||
|
@ -172,10 +168,8 @@ interface File default _File {
|
|||
*
|
||||
* FileMode.APPEND: create the stream and set the position to the end of
|
||||
* the underlying file.
|
||||
*
|
||||
* By default the mode is FileMode.WRITE.
|
||||
*/
|
||||
OutputStream openOutputStream([FileMode mode]);
|
||||
OutputStream openOutputStream([FileMode mode = FileMode.WRITE]);
|
||||
|
||||
/**
|
||||
* Read the entire file contents as a list of bytes. Returns a
|
||||
|
@ -191,34 +185,33 @@ interface File default _File {
|
|||
|
||||
/**
|
||||
* Read the entire file contents as text using the given
|
||||
* [encoding]. The default encoding is [:Encoding.UTF_8:].
|
||||
* [encoding].
|
||||
*
|
||||
* Returns a [:Future<String>:] that completes with the string once
|
||||
* the file contents has been read.
|
||||
*/
|
||||
Future<String> readAsText([Encoding encoding]);
|
||||
Future<String> readAsText([Encoding encoding = Encoding.UTF_8]);
|
||||
|
||||
/**
|
||||
* Synchronously read the entire file contents as text using the
|
||||
* given [encoding]. The default encoding is [:Encoding.UTF_8:].
|
||||
* given [encoding].
|
||||
*/
|
||||
String readAsTextSync([Encoding encoding]);
|
||||
String readAsTextSync([Encoding encoding = Encoding.UTF_8]);
|
||||
|
||||
/**
|
||||
* Read the entire file contents as lines of text using the give
|
||||
* [encoding]. The default encoding is [:Encoding.UTF_8:].
|
||||
* [encoding].
|
||||
*
|
||||
* Returns a [:Future<List<String>>:] that completes with the lines
|
||||
* once the file contents has been read.
|
||||
*/
|
||||
Future<List<String>> readAsLines([Encoding encoding]);
|
||||
Future<List<String>> readAsLines([Encoding encoding = Encoding.UTF_8]);
|
||||
|
||||
/**
|
||||
* Synchronously read the entire file contents as lines of text
|
||||
* using the given [encoding] The default encoding is
|
||||
* [:Encoding.UTF_8:].
|
||||
* using the given [encoding].
|
||||
*/
|
||||
List<String> readAsLinesSync([Encoding encoding]);
|
||||
List<String> readAsLinesSync([Encoding encoding = Encoding.UTF_8]);
|
||||
|
||||
/**
|
||||
* Get the name of the file.
|
||||
|
@ -232,7 +225,7 @@ interface File default _File {
|
|||
* file. [RandomAccessFile] objects are obtained by calling the
|
||||
* [:open:] method on a [File] object.
|
||||
*/
|
||||
interface RandomAccessFile {
|
||||
abstract class RandomAccessFile {
|
||||
/**
|
||||
* Close the file. Returns a [:Future<RandomAccessFile>:] that
|
||||
* completes with this RandomAccessFile when it has been closed.
|
||||
|
@ -295,19 +288,20 @@ interface RandomAccessFile {
|
|||
int writeListSync(List<int> buffer, int offset, int bytes);
|
||||
|
||||
/**
|
||||
* Write a string to the file using the given [encoding]. The
|
||||
* default encoding is UTF-8 - [:Encoding.UTF_8:]. Returns a
|
||||
* Write a string to the file using the given [encoding]. Returns a
|
||||
* [:Future<RandomAccessFile>:] that completes with this
|
||||
* RandomAccessFile when the write completes.
|
||||
*/
|
||||
Future<RandomAccessFile> writeString(String string, [Encoding encoding]);
|
||||
Future<RandomAccessFile> writeString(String string,
|
||||
[Encoding encoding = Encoding.UTF_8]);
|
||||
|
||||
/**
|
||||
* Synchronously write a single string to the file using the given
|
||||
* [encoding]. Returns the number of characters successfully
|
||||
* written. The default encoding is UTF-8 - [:Encoding.UTF_8:].
|
||||
* written.
|
||||
*/
|
||||
int writeStringSync(String string, [Encoding encoding]);
|
||||
int writeStringSync(String string,
|
||||
[Encoding encoding = Encoding.UTF_8]);
|
||||
|
||||
/**
|
||||
* Get the current byte position in the file. Returns a
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* HTTP status codes.
|
||||
*/
|
||||
interface HttpStatus {
|
||||
abstract class HttpStatus {
|
||||
static const int CONTINUE = 100;
|
||||
static const int SWITCHING_PROTOCOLS = 101;
|
||||
static const int OK = 200;
|
||||
|
@ -55,8 +55,8 @@ interface HttpStatus {
|
|||
/**
|
||||
* HTTP server.
|
||||
*/
|
||||
interface HttpServer default _HttpServer {
|
||||
HttpServer();
|
||||
abstract class HttpServer {
|
||||
factory HttpServer() => new _HttpServer();
|
||||
|
||||
/**
|
||||
* Start listening for HTTP requests on the specified [host] and
|
||||
|
@ -122,7 +122,7 @@ interface HttpServer default _HttpServer {
|
|||
* For all operation on HTTP headers the header name is
|
||||
* case-insensitive.
|
||||
*/
|
||||
interface HttpHeaders default _HttpHeaders {
|
||||
abstract class HttpHeaders {
|
||||
static const ACCEPT = "Accept";
|
||||
static const ACCEPT_CHARSET = "Accept-Charset";
|
||||
static const ACCEPT_ENCODING = "Accept-Encoding";
|
||||
|
@ -354,17 +354,19 @@ interface HttpHeaders default _HttpHeaders {
|
|||
* // Use v.value and v.parameters
|
||||
* });
|
||||
*/
|
||||
interface HeaderValue default _HeaderValue {
|
||||
abstract class HeaderValue {
|
||||
/**
|
||||
* Creates a new header value object setting the value part.
|
||||
*/
|
||||
HeaderValue([String value]);
|
||||
factory HeaderValue([String value = ""]) => new _HeaderValue(value);
|
||||
|
||||
/**
|
||||
* Creates a new header value object from parsing a header value
|
||||
* string with both value and optional parameters.
|
||||
*/
|
||||
HeaderValue.fromString(String value);
|
||||
factory HeaderValue.fromString(String value) {
|
||||
return new _HeaderValue.fromString(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and sets the header value.
|
||||
|
@ -388,13 +390,14 @@ interface HeaderValue default _HeaderValue {
|
|||
/**
|
||||
* Representation of a content type.
|
||||
*/
|
||||
interface ContentType extends HeaderValue default _ContentType {
|
||||
abstract class ContentType implements HeaderValue {
|
||||
/**
|
||||
* Creates a new content type object setting the primary type and
|
||||
* sub type. If either is not passed their values will be the empty
|
||||
* string.
|
||||
* sub type.
|
||||
*/
|
||||
ContentType([String primaryType, String subType]);
|
||||
factory ContentType([String primaryType = "", String subType = ""]) {
|
||||
return new _ContentType(primaryType, subType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new content type object from parsing a Content-Type
|
||||
|
@ -407,7 +410,9 @@ interface ContentType extends HeaderValue default _ContentType {
|
|||
* will create a content type object with primary type [:text:], sub
|
||||
* type [:html:] and parameter [:charset:] with value [:utf-8:].
|
||||
*/
|
||||
ContentType.fromString(String value);
|
||||
factory ContentType.fromString(String value) {
|
||||
return new _ContentType.fromString(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and sets the content type in the form "primaryType/subType".
|
||||
|
@ -438,17 +443,19 @@ interface ContentType extends HeaderValue default _ContentType {
|
|||
* and when receiving cookies in the client as Set-Cookie headers all
|
||||
* fields can be used.
|
||||
*/
|
||||
interface Cookie default _Cookie {
|
||||
abstract class Cookie {
|
||||
/**
|
||||
* Creates a new cookie optionally setting the name and value.
|
||||
*/
|
||||
Cookie([String name, String value]);
|
||||
factory Cookie([String name, String value]) => new _Cookie(name, value);
|
||||
|
||||
/**
|
||||
* Creates a new cookie by parsing a header value from a Set-Cookie
|
||||
* header.
|
||||
*/
|
||||
Cookie.fromSetCookieValue(String value);
|
||||
factory Cookie.fromSetCookieValue(String value) {
|
||||
return new _Cookie.fromSetCookieValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets and sets the name.
|
||||
|
@ -503,7 +510,7 @@ interface Cookie default _Cookie {
|
|||
/**
|
||||
* Http request delivered to the HTTP server callback.
|
||||
*/
|
||||
interface HttpRequest default _HttpRequest {
|
||||
abstract class HttpRequest {
|
||||
/**
|
||||
* Returns the content length of the request body. If the size of
|
||||
* the request body is not known in advance this -1.
|
||||
|
@ -573,7 +580,7 @@ interface HttpRequest default _HttpRequest {
|
|||
/**
|
||||
* HTTP response to be send back to the client.
|
||||
*/
|
||||
interface HttpResponse default _HttpResponse {
|
||||
abstract class HttpResponse {
|
||||
/**
|
||||
* Gets and sets the content length of the response. If the size of
|
||||
* the response is not known in advance set the content length to
|
||||
|
@ -649,10 +656,10 @@ interface HttpResponse default _HttpResponse {
|
|||
* must be closed as part of completing the request. Use [:HttpClient.shutdown:]
|
||||
* to force close the idle sockets.
|
||||
*/
|
||||
interface HttpClient default _HttpClient {
|
||||
abstract class HttpClient {
|
||||
static const int DEFAULT_HTTP_PORT = 80;
|
||||
|
||||
HttpClient();
|
||||
factory HttpClient() => new _HttpClient();
|
||||
|
||||
/**
|
||||
* Opens a HTTP connection. The returned [HttpClientConnection] is
|
||||
|
@ -717,7 +724,7 @@ interface HttpClient default _HttpClient {
|
|||
* empty body. If [onResponse] is not set the response will be read
|
||||
* and discarded.
|
||||
*/
|
||||
interface HttpClientConnection {
|
||||
abstract class HttpClientConnection {
|
||||
/**
|
||||
* Sets the handler that is called when the connection is established.
|
||||
*/
|
||||
|
@ -786,7 +793,7 @@ interface HttpClientConnection {
|
|||
/**
|
||||
* HTTP request for a client connection.
|
||||
*/
|
||||
interface HttpClientRequest default _HttpClientRequest {
|
||||
abstract class HttpClientRequest {
|
||||
/**
|
||||
* Gets and sets the content length of the request. If the size of
|
||||
* the request is not known in advance set content length to -1,
|
||||
|
@ -826,7 +833,7 @@ interface HttpClientRequest default _HttpClientRequest {
|
|||
/**
|
||||
* HTTP response for a client connection.
|
||||
*/
|
||||
interface HttpClientResponse default _HttpClientResponse {
|
||||
abstract class HttpClientResponse {
|
||||
/**
|
||||
* Returns the status code.
|
||||
*/
|
||||
|
@ -876,7 +883,7 @@ interface HttpClientResponse default _HttpClientResponse {
|
|||
/**
|
||||
* Connection information.
|
||||
*/
|
||||
interface HttpConnectionInfo {
|
||||
abstract class HttpConnectionInfo {
|
||||
String get remoteHost;
|
||||
int get remotePort;
|
||||
int get localPort;
|
||||
|
@ -886,7 +893,7 @@ interface HttpConnectionInfo {
|
|||
/**
|
||||
* Redirect information.
|
||||
*/
|
||||
interface RedirectInfo {
|
||||
abstract class RedirectInfo {
|
||||
/**
|
||||
* Returns the status code used for the redirect.
|
||||
*/
|
||||
|
@ -911,7 +918,7 @@ interface RedirectInfo {
|
|||
* together with the detached socket is returned in an instance of
|
||||
* this class.
|
||||
*/
|
||||
interface DetachedSocket default _DetachedSocket {
|
||||
abstract class DetachedSocket {
|
||||
Socket get socket;
|
||||
List<int> get unparsedData;
|
||||
}
|
||||
|
|
|
@ -427,8 +427,8 @@ class _HeaderValue implements HeaderValue {
|
|||
|
||||
|
||||
class _ContentType extends _HeaderValue implements ContentType {
|
||||
_ContentType([String primaryType = "", String subType = ""])
|
||||
: _primaryType = primaryType, _subType = subType;
|
||||
_ContentType(String primaryType, String subType)
|
||||
: _primaryType = primaryType, _subType = subType, super("");
|
||||
|
||||
_ContentType.fromString(String value) : super.fromString(value);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
* Always set up appropriate handlers when using input streams.
|
||||
*
|
||||
*/
|
||||
interface InputStream {
|
||||
abstract class InputStream {
|
||||
/**
|
||||
* Reads data from the stream. Returns a system allocated buffer
|
||||
* with up to [len] bytes. If no value is passed for [len] all
|
||||
|
@ -58,10 +58,9 @@ interface InputStream {
|
|||
* stream [output]. The default behavior is to close the output when
|
||||
* all the data from the input stream have been written. Specifying
|
||||
* `false` for the optional argument [close] keeps the output
|
||||
* stream open after writing all data from the input stream. The
|
||||
* default value for [close] is `true`.
|
||||
* stream open after writing all data from the input stream.
|
||||
*/
|
||||
void pipe(OutputStream output, [bool close]);
|
||||
void pipe(OutputStream output, [bool close = true]);
|
||||
|
||||
/**
|
||||
* Close the underlying communication channel to avoid getting any
|
||||
|
@ -114,12 +113,15 @@ class Encoding {
|
|||
* string data. This data can be read either as string chunks or as
|
||||
* lines separated by line termination character sequences.
|
||||
*/
|
||||
interface StringInputStream default _StringInputStream {
|
||||
abstract class StringInputStream {
|
||||
/**
|
||||
* Decodes a binary input stream into characters using the specified
|
||||
* encoding. The default encoding is UTF-8 - `Encoding.UTF_8`.
|
||||
* encoding.
|
||||
*/
|
||||
StringInputStream(InputStream input, [Encoding encoding]);
|
||||
factory StringInputStream(InputStream input,
|
||||
[Encoding encoding = Encoding.UTF_8]) {
|
||||
return new _StringInputStream(input, encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads up to [len] characters from the stream. if [len] is not
|
||||
|
@ -188,12 +190,14 @@ interface StringInputStream default _StringInputStream {
|
|||
* A chunked input stream wraps a basic input stream and supplies
|
||||
* binary data in configurable chunk sizes.
|
||||
*/
|
||||
interface ChunkedInputStream default _ChunkedInputStream {
|
||||
abstract class ChunkedInputStream {
|
||||
/**
|
||||
* Adds buffering to an input stream and provide the ability to read
|
||||
* the data in known size chunks.
|
||||
*/
|
||||
ChunkedInputStream(InputStream input, [int chunkSize]);
|
||||
factory ChunkedInputStream(InputStream input, [int chunkSize = 0]) {
|
||||
return new _ChunkedInputStream(input, chunkSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads [chunkSize] bytes from the stream. If [chunkSize] bytes are
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
* method must be called when the last data has been written to the
|
||||
* [ListInputStream].
|
||||
*/
|
||||
interface ListInputStream extends InputStream default _ListInputStream {
|
||||
abstract class ListInputStream implements InputStream {
|
||||
/**
|
||||
* Create an empty [ListInputStream] to which data can be written
|
||||
* using the [write] method.
|
||||
*/
|
||||
ListInputStream();
|
||||
factory ListInputStream() => new _ListInputStream();
|
||||
|
||||
/**
|
||||
* Write more data to be streamed over to the [ListInputStream].
|
||||
|
@ -36,11 +36,11 @@ interface ListInputStream extends InputStream default _ListInputStream {
|
|||
* [ListOutputStream] makes it possible to use the [OutputStream]
|
||||
* interface to write data to a [List] of integers.
|
||||
*/
|
||||
interface ListOutputStream extends OutputStream default _ListOutputStream {
|
||||
abstract class ListOutputStream implements OutputStream {
|
||||
/**
|
||||
* Create a [ListOutputStream].
|
||||
*/
|
||||
ListOutputStream();
|
||||
factory ListOutputStream() => new _ListOutputStream();
|
||||
|
||||
/**
|
||||
* Reads all available data from the stream. If no data is available `null`
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* writing in sync with the rate the system can actually write data to
|
||||
* the underlying communication channel.
|
||||
*/
|
||||
interface OutputStream {
|
||||
abstract class OutputStream {
|
||||
/**
|
||||
* Writes the content of [buffer] to the stream. If [copyBuffer] is
|
||||
* false ownership of the specified buffer is passed to the system
|
||||
|
|
|
@ -9,14 +9,13 @@
|
|||
* useful path manipulations and queries. Joining of paths and normalization
|
||||
* interpret '.' and '..' in the usual way.
|
||||
*/
|
||||
interface Path extends Hashable default _Path {
|
||||
abstract class Path extends Hashable {
|
||||
/**
|
||||
* Creates a Path from the String [source]. [source] is used as-is, so if
|
||||
* the string does not consist of segments separated by forward slashes, the
|
||||
* behavior may not be as expected. Paths are immutable, and constant
|
||||
* Path objects may be constructed from constant Strings.
|
||||
* behavior may not be as expected. Paths are immutable.
|
||||
*/
|
||||
const Path(String source);
|
||||
factory Path(String source) => new _Path(source);
|
||||
|
||||
/**
|
||||
* Creates a Path from a String that uses the native filesystem's conventions.
|
||||
|
@ -24,7 +23,7 @@ interface Path extends Hashable default _Path {
|
|||
* A path starting with '/c:/' (or any other character instead of 'c') is
|
||||
* treated specially. Backwards links ('..') cannot cancel the drive letter.
|
||||
*/
|
||||
Path.fromNative(String source);
|
||||
factory Path.fromNative(String source) => new _Path.fromNative(source);
|
||||
|
||||
/**
|
||||
* Is this path the empty string?
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
class _Path implements Path {
|
||||
final String _path;
|
||||
|
||||
const _Path(String source) : _path = source;
|
||||
_Path(String source) : _path = source;
|
||||
_Path.fromNative(String source) : _path = _clean(source);
|
||||
|
||||
int hashCode() => _path.hashCode();
|
||||
|
|
|
@ -99,14 +99,14 @@ class Process {
|
|||
abstract void set onError(void callback(e));
|
||||
|
||||
/**
|
||||
* On Windows, [kill] kills the process, ignoring the [signal] flag. On
|
||||
* Posix systems, [kill] sends [signal] to the process. Depending on the
|
||||
* signal giving, it'll have different meanings. The default [signal] to
|
||||
* send is [:ProcessSignal.SIGTERM:]. When the process terminates as a result
|
||||
* of calling [kill] [onExit] is called. If the kill operation fails,
|
||||
* [onError] is called.
|
||||
* On Windows, [kill] kills the process, ignoring the [signal]
|
||||
* flag. On Posix systems, [kill] sends [signal] to the
|
||||
* process. Depending on the signal giving, it'll have different
|
||||
* meanings. When the process terminates as a result of calling
|
||||
* [kill] [onExit] is called. If the kill operation fails, [onError]
|
||||
* is called.
|
||||
*/
|
||||
abstract void kill([ProcessSignal signal]);
|
||||
abstract void kill([ProcessSignal signal = ProcessSignal.SIGTERM]);
|
||||
|
||||
/**
|
||||
* Terminates the streams of a process. [close] must be called on a
|
||||
|
@ -125,7 +125,7 @@ class Process {
|
|||
* [ProcessResult] represents the result of running a non-interactive
|
||||
* process started with [:Process.run:].
|
||||
*/
|
||||
interface ProcessResult {
|
||||
abstract class ProcessResult {
|
||||
/**
|
||||
* Exit code for the process.
|
||||
*/
|
||||
|
@ -229,7 +229,7 @@ class ProcessSignal {
|
|||
|
||||
|
||||
class ProcessException implements Exception {
|
||||
const ProcessException([String this.message, int this.errorCode = 0]);
|
||||
const ProcessException([String this.message = "", int this.errorCode = 0]);
|
||||
String toString() => "ProcessException: $message ($errorCode)";
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
interface ServerSocket default _ServerSocket {
|
||||
abstract class ServerSocket {
|
||||
/**
|
||||
* Constructs a new server socket, binds it to a given address and port,
|
||||
* and listens on it.
|
||||
*/
|
||||
ServerSocket(String bindAddress, int port, int backlog);
|
||||
factory ServerSocket(String bindAddress, int port, int backlog) {
|
||||
return new _ServerSocket(bindAddress, port, backlog);
|
||||
}
|
||||
|
||||
/**
|
||||
* The connection handler gets called when there is a new incoming
|
||||
|
@ -32,13 +34,13 @@ interface ServerSocket default _ServerSocket {
|
|||
}
|
||||
|
||||
|
||||
interface Socket extends Hashable default _Socket {
|
||||
abstract class Socket implements Hashable {
|
||||
/**
|
||||
* Constructs a new socket and initiate connecting it to the given
|
||||
* host on the given port. The returned socket is not yet connected
|
||||
* but ready for registration of callbacks.
|
||||
*/
|
||||
Socket(String host, int port);
|
||||
factory Socket(String host, int port) => new _Socket(host, port);
|
||||
|
||||
/**
|
||||
* Returns the number of received and non-read bytes in the socket that
|
||||
|
@ -125,7 +127,7 @@ interface Socket extends Hashable default _Socket {
|
|||
* possible to read data. Calling [close] will not trigger a call to
|
||||
* [onClosed].
|
||||
*/
|
||||
void close([bool halfClose]);
|
||||
void close([bool halfClose = false]);
|
||||
|
||||
/**
|
||||
* Socket is hashable.
|
||||
|
|
|
@ -6,21 +6,20 @@
|
|||
* [SocketInputStream] makes it possible to stream over data received
|
||||
* from a [Socket].
|
||||
*/
|
||||
interface SocketInputStream extends InputStream default _SocketInputStream {
|
||||
abstract class SocketInputStream implements InputStream {
|
||||
/**
|
||||
* Create a [SocketInputStream] for streaming from a [Socket].
|
||||
*/
|
||||
SocketInputStream(Socket socket);
|
||||
|
||||
factory SocketInputStream(Socket socket) => new _SocketInputStream(socket);
|
||||
}
|
||||
|
||||
/**
|
||||
* [SocketOutputStream] makes it possible to stream data to a
|
||||
* [Socket].
|
||||
*/
|
||||
interface SocketOutputStream extends OutputStream default _SocketOutputStream {
|
||||
abstract class SocketOutputStream implements OutputStream {
|
||||
/**
|
||||
* Create a [SocketOutputStream] for streaming to a [Socket].
|
||||
*/
|
||||
SocketOutputStream(Socket socket);
|
||||
factory SocketOutputStream(Socket socket) => new _SocketOutputStream(socket);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Interface for decoders decoding binary data into string data. The
|
||||
// decoder keeps track of line breaks during decoding.
|
||||
interface _StringDecoder {
|
||||
abstract class _StringDecoder {
|
||||
// Add more binary data to be decoded. The ownership of the buffer
|
||||
// is transfered to the decoder and the caller most not modify it any more.
|
||||
int write(List<int> buffer);
|
||||
|
@ -245,7 +245,7 @@ class _Latin1Decoder extends _StringDecoderBase {
|
|||
|
||||
|
||||
// Interface for encoders encoding string data into binary data.
|
||||
interface _StringEncoder {
|
||||
abstract class _StringEncoder {
|
||||
List<int> encodeString(String string);
|
||||
}
|
||||
|
||||
|
@ -355,9 +355,7 @@ class EncoderException implements Exception {
|
|||
|
||||
|
||||
class _StringInputStream implements StringInputStream {
|
||||
_StringInputStream(InputStream this._input,
|
||||
[Encoding encoding = Encoding.UTF_8])
|
||||
: _encoding = encoding {
|
||||
_StringInputStream(InputStream this._input, Encoding this._encoding) {
|
||||
_decoder = _StringDecoders.decoder(encoding);
|
||||
_input.onData = _onData;
|
||||
_input.onClosed = _onClosed;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* Web socket status codes used when closing a web socket connection.
|
||||
*/
|
||||
interface WebSocketStatus {
|
||||
abstract class WebSocketStatus {
|
||||
static const int NORMAL_CLOSURE = 1000;
|
||||
static const int GOING_AWAY = 1001;
|
||||
static const int PROTOCOL_ERROR = 1002;
|
||||
|
@ -38,8 +38,8 @@ interface WebSocketStatus {
|
|||
*
|
||||
* This handler strives to implement web sockets as specified by RFC6455.
|
||||
*/
|
||||
interface WebSocketHandler default _WebSocketHandler {
|
||||
WebSocketHandler();
|
||||
abstract class WebSocketHandler {
|
||||
factory WebSocketHandler() => new _WebSocketHandler();
|
||||
|
||||
/**
|
||||
* Request handler to be registered with the HTTP server.
|
||||
|
@ -57,7 +57,7 @@ interface WebSocketHandler default _WebSocketHandler {
|
|||
/**
|
||||
* Server web socket connection.
|
||||
*/
|
||||
interface WebSocketConnection extends Hashable {
|
||||
abstract class WebSocketConnection implements Hashable {
|
||||
/**
|
||||
* Sets the callback to be called when a message have been
|
||||
* received. The type on [message] is either [:String:] or
|
||||
|
@ -100,14 +100,15 @@ interface WebSocketConnection extends Hashable {
|
|||
/**
|
||||
* Client web socket connection.
|
||||
*/
|
||||
interface WebSocketClientConnection
|
||||
extends Hashable default _WebSocketClientConnection {
|
||||
abstract class WebSocketClientConnection implements Hashable {
|
||||
/**
|
||||
* Creates a new web socket client connection based on a HTTP client
|
||||
* connection. The HTTP client connection must be freshly opened.
|
||||
*/
|
||||
WebSocketClientConnection(HttpClientConnection conn,
|
||||
[List<String> protocols]);
|
||||
factory WebSocketClientConnection(HttpClientConnection conn,
|
||||
[List<String> protocols]) {
|
||||
return new _WebSocketClientConnection(conn, protocols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the callback to be called when the request object for the
|
||||
|
@ -170,15 +171,15 @@ interface WebSocketClientConnection
|
|||
|
||||
|
||||
/**
|
||||
* Base interface for the events generated by the W3C complient
|
||||
* browser API for web sockets.
|
||||
* Base class for the events generated by the W3C complient browser
|
||||
* API for web sockets.
|
||||
*/
|
||||
interface Event { }
|
||||
abstract class Event { }
|
||||
|
||||
/**
|
||||
* Event delivered when there is data on a web socket connection.
|
||||
*/
|
||||
interface MessageEvent extends Event default _WebSocketMessageEvent {
|
||||
abstract class MessageEvent extends Event {
|
||||
/**
|
||||
* The type of [message] is either [:String:] or [:List<int>:]
|
||||
* depending on whether it is a text or binary message. If the
|
||||
|
@ -191,7 +192,7 @@ interface MessageEvent extends Event default _WebSocketMessageEvent {
|
|||
/**
|
||||
* Event delivered when a web socket connection is closed.
|
||||
*/
|
||||
interface CloseEvent extends Event default _WebSocketCloseEvent {
|
||||
abstract class CloseEvent extends Event {
|
||||
/**
|
||||
* Returns whether the connection was closed cleanly or not.
|
||||
*/
|
||||
|
@ -216,7 +217,7 @@ interface CloseEvent extends Event default _WebSocketCloseEvent {
|
|||
* with the W3C browser API for web sockets specified in
|
||||
* http://dev.w3.org/html5/websockets/.
|
||||
*/
|
||||
interface WebSocket default _WebSocket {
|
||||
abstract class WebSocket {
|
||||
/**
|
||||
* Possible states of the connection.
|
||||
*/
|
||||
|
@ -231,7 +232,7 @@ interface WebSocket default _WebSocket {
|
|||
* [:String:] or [:List<String>:] specifying the subprotocols the
|
||||
* client is willing to speak.
|
||||
*/
|
||||
WebSocket(String url, [protocols]);
|
||||
factory WebSocket(String url, [protocols]) => new _WebSocket(url, protocols);
|
||||
|
||||
/**
|
||||
* Returns the current state of the connection.
|
||||
|
|
|
@ -13,7 +13,7 @@ class Co19TestSuite extends StandardTestSuite {
|
|||
Co19TestSuite(Map configuration)
|
||||
: super(configuration,
|
||||
"co19",
|
||||
const Path("tests/co19/src"),
|
||||
new Path("tests/co19/src"),
|
||||
["tests/co19/co19-compiler.status",
|
||||
"tests/co19/co19-runtime.status",
|
||||
"tests/co19/co19-dart2js.status"]);
|
||||
|
|
|
@ -238,8 +238,8 @@ void testContentType() {
|
|||
}
|
||||
}
|
||||
|
||||
_ContentType contentType;
|
||||
contentType = new _ContentType();
|
||||
ContentType contentType;
|
||||
contentType = new ContentType();
|
||||
Expect.equals("", contentType.primaryType);
|
||||
Expect.equals("", contentType.subType);
|
||||
Expect.equals("/", contentType.value);
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
* simpler to add them to test.dart. Existing test suites should be
|
||||
* moved to here, if possible.
|
||||
*/
|
||||
final TEST_SUITE_DIRECTORIES = const [
|
||||
const Path('runtime/tests/vm'),
|
||||
const Path('tests/corelib'),
|
||||
const Path('tests/isolate'),
|
||||
const Path('tests/language'),
|
||||
const Path('tests/lib'),
|
||||
const Path('tests/standalone'),
|
||||
const Path('tests/utils'),
|
||||
final TEST_SUITE_DIRECTORIES = [
|
||||
new Path('runtime/tests/vm'),
|
||||
new Path('tests/corelib'),
|
||||
new Path('tests/isolate'),
|
||||
new Path('tests/language'),
|
||||
new Path('tests/lib'),
|
||||
new Path('tests/standalone'),
|
||||
new Path('tests/utils'),
|
||||
];
|
||||
|
||||
main() {
|
||||
|
|
|
@ -42,27 +42,27 @@
|
|||
* simpler to add them to test.dart. Existing test suites should be
|
||||
* moved to here, if possible.
|
||||
*/
|
||||
final TEST_SUITE_DIRECTORIES = const [
|
||||
const Path('pkg'),
|
||||
const Path('runtime/tests/vm'),
|
||||
const Path('samples/tests/samples'),
|
||||
const Path('tests/benchmark_smoke'),
|
||||
const Path('tests/compiler/dart2js'),
|
||||
const Path('tests/compiler/dart2js_extra'),
|
||||
const Path('tests/compiler/dart2js_foreign'),
|
||||
const Path('tests/compiler/dart2js_native'),
|
||||
const Path('tests/corelib'),
|
||||
const Path('tests/dom'),
|
||||
const Path('tests/html'),
|
||||
const Path('tests/isolate'),
|
||||
const Path('tests/json'),
|
||||
const Path('tests/language'),
|
||||
const Path('tests/lib'),
|
||||
const Path('tests/standalone'),
|
||||
const Path('tests/utils'),
|
||||
const Path('utils/tests/css'),
|
||||
const Path('utils/tests/peg'),
|
||||
const Path('utils/tests/pub'),
|
||||
final TEST_SUITE_DIRECTORIES = [
|
||||
new Path('pkg'),
|
||||
new Path('runtime/tests/vm'),
|
||||
new Path('samples/tests/samples'),
|
||||
new Path('tests/benchmark_smoke'),
|
||||
new Path('tests/compiler/dart2js'),
|
||||
new Path('tests/compiler/dart2js_extra'),
|
||||
new Path('tests/compiler/dart2js_foreign'),
|
||||
new Path('tests/compiler/dart2js_native'),
|
||||
new Path('tests/corelib'),
|
||||
new Path('tests/dom'),
|
||||
new Path('tests/html'),
|
||||
new Path('tests/isolate'),
|
||||
new Path('tests/json'),
|
||||
new Path('tests/language'),
|
||||
new Path('tests/lib'),
|
||||
new Path('tests/standalone'),
|
||||
new Path('tests/utils'),
|
||||
new Path('utils/tests/css'),
|
||||
new Path('utils/tests/peg'),
|
||||
new Path('utils/tests/pub'),
|
||||
];
|
||||
|
||||
main() {
|
||||
|
|
|
@ -30,7 +30,7 @@ void main() {
|
|||
final args = new Options().arguments;
|
||||
|
||||
int mode = doc.MODE_STATIC;
|
||||
Path outputDir = const Path('docs');
|
||||
Path outputDir = new Path('docs');
|
||||
bool generateAppCache = false;
|
||||
|
||||
// Parse the command-line arguments.
|
||||
|
|
|
@ -68,8 +68,8 @@ class HtmlDiff {
|
|||
* calling [HtmlDiff.run].
|
||||
*/
|
||||
static void initialize(Path libDir) {
|
||||
_compilation = new Compilation.library(
|
||||
const <Path>[const Path(HTML_LIBRARY_NAME)], libDir);
|
||||
_compilation = new Compilation.library(<Path>[new Path(HTML_LIBRARY_NAME)],
|
||||
libDir);
|
||||
_mirrors = _compilation.mirrors;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue