Example #1
0
	function setEncoding(encoding) {
		validateEncoding(encoding);

		// Recode the buffer to the new encoding
		opts.encoding = encoding;
		var newBuffer = new CircularBuffer(opts);
		if (buffer.length > 0) newBuffer.write(buffer.read());
		buffer = newBuffer;

		return DuplexStream.setEncoding.call(self, encoding);
	}
Example #2
0
	function flush() {
		self.push(buffer.read('buffer'), opts.encoding);
	}
Example #3
0
	function _read(n) {
		self.push(buffer.read(n, 'buffer'), opts.encoding);
	}