OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 ByteReader = function(arrayBuffer, opt_offset, opt_length) { | 5 ByteReader = function(arrayBuffer, opt_offset, opt_length) { |
6 opt_offset = opt_offset || 0; | 6 opt_offset = opt_offset || 0; |
7 opt_length = opt_length || (arrayBuffer.byteLength - opt_offset); | 7 opt_length = opt_length || (arrayBuffer.byteLength - opt_offset); |
8 this.view_ = new DataView(arrayBuffer, opt_offset, opt_length); | 8 this.view_ = new DataView(arrayBuffer, opt_offset, opt_length); |
9 this.pos_ = 0; | 9 this.pos_ = 0; |
10 this.seekStack_ = []; | 10 this.seekStack_ = []; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 ByteReader.prototype.popSeek = function() { | 403 ByteReader.prototype.popSeek = function() { |
404 this.seek(this.seekStack_.pop()); | 404 this.seek(this.seekStack_.pop()); |
405 }; | 405 }; |
406 | 406 |
407 /** | 407 /** |
408 * Return the current read position. | 408 * Return the current read position. |
409 */ | 409 */ |
410 ByteReader.prototype.tell = function() { | 410 ByteReader.prototype.tell = function() { |
411 return this.pos_; | 411 return this.pos_; |
412 }; | 412 }; |
OLD | NEW |