code: function StreamReader(read) {
  
  	var tail = '', messages = new Array();
  
  	/**
  	 * Parsa new data.
  	 * @param {String} data New data from the stream
  	 */
  	function parse(data, initExpected) {
  		var lines, i, last;
  		data = tail + data;
  		data = data.replace(/\r*\n+/g, "\n");
  		lines = data.split("\n");
  		last = lines.length - 1;
  		for (i = 0; i < last; i++) {
  			messages.push(read(lines[i], initExpected));
  		}
  		tail = lines[lines.length - 1];
  	}
  
  	/**
  	 * Pop the next message
  	 */
  	function pop() {
  		return messages.shift();
    	}
  
  	/**
  	 * Return if it has no more messages
  	 */
  	function isEmpty() {
  		return messages.length == 0;
    	}
  
  	// Public methods
  	that = {
  		parse: parse,
  		pop: pop,
  		isEmpty: isEmpty
  	};
  
  
  	return that;
  }
docs: <p>StreamReader constructor.</p>
  
  @class
  @param {Function} read the function to parse the message
  @private