put brains in read
This commit is contained in:
parent
6e1dfd3003
commit
6cee393c5d
@ -23,14 +23,15 @@ BufferReader.prototype.eof = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
BufferReader.prototype.buffer = function(len) {
|
BufferReader.prototype.buffer = function(len) {
|
||||||
var buf = this.buf.slice(this.pos, this.pos + len);
|
return this.read(len);
|
||||||
this.pos = this.pos + len;
|
|
||||||
return buf;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
BufferReader.prototype.read = function(len) {
|
BufferReader.prototype.read = function(len) {
|
||||||
if (len)
|
if (len) {
|
||||||
return this.buffer(len);
|
var buf = this.buf.slice(this.pos, this.pos + len);
|
||||||
|
this.pos = this.pos + len;
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
var buf = this.buf.slice(this.pos);
|
var buf = this.buf.slice(this.pos);
|
||||||
this.pos = this.buf.length;
|
this.pos = this.buf.length;
|
||||||
return buf;
|
return buf;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user