Bug 569706 - convert text-streams.md to apidocs format. r=adw, a=myk
authorNoelle Murata <fiveinchpixie@gmail.com>
Wed, 18 Aug 2010 16:20:26 -0700
changeset 731 2e72b5ee7f1ae3e01f8cda80305f35abad04d649
parent 730 24e2df1a66ebdfd9fff7dcc6a7277c217945dfe4
child 732 bfe0904f9656cc4654cdb3c5e6732a01f52c2147
push id262
push userdwillcoxon@mozilla.com
push dateWed, 18 Aug 2010 23:21:12 +0000
reviewersadw, myk
bugs569706
Bug 569706 - convert text-streams.md to apidocs format. r=adw, a=myk
packages/jetpack-core/docs/text-streams.md
--- a/packages/jetpack-core/docs/text-streams.md
+++ b/packages/jetpack-core/docs/text-streams.md
@@ -2,89 +2,98 @@
 <!-- edited by Noelle Murata [fiveinchpixie@gmail.com]  -->
 
 The `text-streams` module provides streams for reading and writing text using
 particular character encodings.
 
 Constructors
 ------------
 
-<code>textStreams.**TextReader**(*inputStream*, *charset*)</code>
-
-Creates a buffered input stream that reads text from a backing stream using a
-given text encoding.
-
-*`inputStream`* is the backing stream and must be an
-[`nsIInputStream`][nsIInputStream].  It must already be opened.
-
-Text in *`inputStream`* is expected to be in the character encoding named by
-*`charset`*.  If not given, "UTF-8" is assumed.  See
-[`nsICharsetConverterManager.idl`][nsICharsetConverterManager] for documentation
-on how to determine other valid values for this.
+<api name="TextReader">
+@constructor
+  Creates a buffered input stream that reads text from a backing stream using a
+  given text encoding.
+@param inputStream {stream}
+  The backing stream, an [`nsIInputStream`](http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsIInputStream.idl).
+  It must already be opened.
+@param [charset] {string}
+  `inputStream` is expected to be in the character encoding named by this value.
+  If not specified, "UTF-8" is assumed.  See [`nsICharsetConverterManager.idl`](http://mxr.mozilla.org/mozilla-central/source/intl/uconv/idl/nsICharsetConverterManager.idl)
+  for documentation on how to determine other valid values for this.
+</api>
 
-[nsIInputStream]: http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsIInputStream.idl
-[nsICharsetConverterManager]: http://mxr.mozilla.org/mozilla-central/source/intl/uconv/idl/nsICharsetConverterManager.idl
-
-<code>textStreams.**TextWriter**(*outputStream*, *charset*)</code>
-
-Creates a buffered output stream that writes text to a backing stream using a
-given text encoding.
-
-*`outputStream`* is the backing stream and must be an
-[`nsIOutputStream`][nsIOutputStream].  It must already be opened.
-
-Text will be written to *`outputStream`* using the character encoding named by
-*`charset`*.  If not given, "UTF-8" is assumed.  See
-[`nsICharsetConverterManager.idl`][nsICharsetConverterManager] for documentation
-on how to determine other valid values for this.
-
-[nsIOutputStream]: http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsIOutputStream.idl
+<api name="TextWriter">
+@constructor
+  Creates a buffered output stream that writes text to a backing stream using a
+  given text encoding.
+@param outputStream {stream}
+  The backing stream, an [`nsIOutputStream`](http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsIOutputStream.idl).
+  It must already be opened.
+@param [charset] {string}
+  `outputStream` is expected to be in the character encoding named by this
+  value.  If not specified, "UTF-8" is assumed.  See [`nsICharsetConverterManager.idl`](http://mxr.mozilla.org/mozilla-central/source/intl/uconv/idl/nsICharsetConverterManager.idl)
+  for documentation on how to determine other valid values for this.
+</api>
 
 
 TextReader Objects
 ------------------
 
-<code>TextReader.**closed**</code>
-
-True if the stream is closed.
-
-<code>TextReader.**close**()</code>
+<api name="closed">
+@property {boolean}
+  True if the stream is closed.
+</api>
 
-Closes both the stream and its backing stream.
-
-<code>TextReader.**read**(*numChars*)</code>
+<api name="close">
+@method
+  Closes both the stream and its backing stream.
+</api>
 
-Reads and returns a string from the stream.  If the stream is closed, an
-exception is thrown.  *`numChars`* is the number of characters to read.  If not
-given, the remainder of the stream is read.  If the stream is already at EOS,
-the empty string is returned.
+<api name="read">
+@method
+  Reads and returns a string from the stream.  If the stream is closed, an
+  exception is thrown.
+@param [numChars] {number}
+  The number of characters to read.  If not given, the remainder of the stream
+  is read.  If the stream is at the end, the empty string is returned.
+</api>
 
 
 TextWriter Objects
 ------------------
 
-<code>TextWriter.**closed**</code>
-
-True if the stream is closed.
-
-<code>TextWriter.**close**()</code>
+<api name="closed">
+@property {boolean}
+  True if the stream is closed.
+</api>
 
-Flushes the backing stream's buffer and closes both the stream and the backing
-stream.  If the stream is already closed, an exception is thrown.
+<api name="close">
+@method
+  Flushes the backing stream's buffer and closes both the stream and the backing
+  stream.  If the stream is already closed, an exception is thrown.
+</api>
 
-<code>TextWriter.**flush**()</code>
-
-Flushes the backing stream's buffer.
+<api name="flush">
+@method
+  Flushes the backing stream's buffer.
+</api>
 
-<code>TextWriter.**write**(*str*)</code>
-
-Writes a string to the stream.  If the stream is closed, an exception is thrown.
-
-<code>TextWriter.**writeAsync**(*str*, *callback*)</code>
+<api name="write">
+@method
+  Writes a string to the stream.  If the stream is closed, an exception is
+  thrown.
+@param str {string}
+  The string to write.
+</api>
 
-Writes a string on a background thread.  After the write completes, the backing
-stream's buffer is flushed, and both the stream and the backing stream are
-closed, also on the background thread.  If the stream is already closed, an
-exception is thrown immediately.
-
-*`callback`*, if given, must be a function.  It's called as `callback(error)`
- when the write completes.  `error` is an `Error` object or undefined if there
- was no error.  Inside *`callback`*, `this` is the `TextWriter` object.
+<api name="writeAsync">
+@method
+  Writes a string on a background thread.  After the write completes, the
+  backing stream's buffer is flushed, and both the stream and the backing stream
+  are closed, also on the background thread.  If the stream is already closed,
+  an exception is thrown immediately.
+@param str {string}
+  The string to write.
+@param [callback] {callback}
+  *`callback`*, if given, must be a function.  It's called as `callback(error)`
+   when the write completes.  `error` is an `Error` object or undefined if there
+   was no error.  Inside *`callback`*, `this` is the `TextWriter` object.
+</api>