diff --git a/modules/io.js b/modules/io.js
index d3db880c9..7d419f416 100644
--- a/modules/io.js
+++ b/modules/io.js
@@ -332,8 +332,8 @@ exports.MemoryStream = function MemoryStream(binaryOrNumber) {
* @param {Object} options the options object. Supports the following properties:
*
- charset: string containing the name of the encoding to use.
* Defaults to "utf8".
- * - newline: string containing the newline character sequence to use.
- * Defaults to "\n".
+ * - newline: string containing the newline character sequence to use in
+ * writeLine() and writeLines(). Defaults to "\n".
* - delimiter: string containing the delimiter to use in print().
* Defaults to " ".
* @param {number} buflen optional buffer size. Defaults to 8192.
@@ -386,7 +386,7 @@ exports.TextStream = function TextStream(io, options, buflen) {
/**
* Reads a line from this stream. If the end of the stream is reached
* before any data is gathered, returns an empty string. Otherwise, returns
- * the line including the newline.
+ * the line including only the newline character. Carriage return will be dropped.
* @returns {String} the next line
*/
this.readLine = function () {
@@ -457,7 +457,7 @@ exports.TextStream = function TextStream(io, options, buflen) {
};
/**
- * Not implemented for TextStraim. Calling this method will raise an error.
+ * Not implemented for TextStream. Calling this method will raise an error.
*/
this.readInto = function (buffer) {
throw new Error("Not implemented");
diff --git a/test/io_test.js b/test/io_test.js
index ace3a0408..c1cd9a22a 100644
--- a/test/io_test.js
+++ b/test/io_test.js
@@ -47,3 +47,17 @@ exports.testMemoryStream = function() {
}
assert.deepEqual(m.read(bytes.length), new ByteString());
}
+
+exports.testTextStream = function() {
+ // Carriage return should be dropped
+ var input = new java.io.ByteArrayInputStream((new java.lang.String("Hello\r\nWorld!")).getBytes("UTF-8"));
+ var stream = new TextStream(new Stream(input));
+ var lines = stream.readLines();
+
+ assert.strictEqual(lines[0], "Hello\n");
+ assert.strictEqual(lines[1], "World!");
+};
+
+if (module == require.main) {
+ require("test").run(exports);
+}