import {DataStream} from './DataStream';
//==========================================================
// 数据流。
//
// @author maocy
// @history 141230
//==========================================================
export class ByteStream extends DataStream {
//..........................................................
protected _length: number;
protected _memory: ArrayBuffer;
//==========================================================
// 构造处理。
//
// @author maocy
// @history 141230
//==========================================================
public constructor() {
super();
this._length = 0
}
//==========================================================
// 设置长度。
//
// @method
// @param length:Integer 长度
//==========================================================
public setLength(length) {
this._length = length;
this._memory = new ArrayBuffer(length);
this.viewer = new DataView(this._memory);
}
//==========================================================
// 反转数据处理。
//==========================================================
public flip() {
this._length = this.position;
this.position = 0;
}
//==========================================================
// 释放处理。
//
// @author maocy
//==========================================================
public dispose() {
this.viewer = null;
this._memory = null;
super.dispose();
}
}