|
|
@ -23,14 +23,15 @@ BufferReader.prototype.eof = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
BufferReader.prototype.buffer = function(len) { |
|
|
|
var buf = this.buf.slice(this.pos, this.pos + len); |
|
|
|
this.pos = this.pos + len; |
|
|
|
return buf; |
|
|
|
return this.read(len); |
|
|
|
}; |
|
|
|
|
|
|
|
BufferReader.prototype.read = function(len) { |
|
|
|
if (len) |
|
|
|
return this.buffer(len); |
|
|
|
if (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); |
|
|
|
this.pos = this.buf.length; |
|
|
|
return buf; |
|
|
|