[]Byte writeArrayBuffer的Bug
__proto.writeArrayBuffer=function(arraybuffer,offset,length){
(offset===void 0)&& (offset=0);
(length===void 0)&& (length=0);
if (offset < 0 || length < 0)throw "writeArrayBuffer error - Out of bounds";
if (length==0)length=arraybuffer.byteLength-offset;
this.ensureWrite(this._pos_+length);
var uint8array=new Uint8Array(arraybuffer);
this._u8d_.set(uint8array.subarray(offset,offset+length),this._pos_);
this._pos_+=length;
}
这里arraybuffer 是一个ByteArray,运行var uint8array=new Uint8Array(arraybuffer);时nei内容丢失。
请问怎么拷贝arraybuffer._byteview_中的数据?
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
qian
赞同来自:
能上传个示例说一下么
darren
赞同来自:
public function send(msg:Message):void{
trace("发送消息:",msg);
output = this.socket.output;
output.writeUint16(getCode(msg));
var bytes:WritingBuffer = new WritingBuffer();
msg.writeDelimitedTo(bytes);
trace("编码长度:",bytes.length,"内容:",bytes);
bytes.position = 0;
output.writeArrayBuffer(bytes["_byteView_"]);
this.socket.flush();com.tengxun.utils.ByteArray
}
darren
赞同来自:
服务端报错
proto: bad wiretype for field message.Login.Password: got wiretype 7, want 2
message Login{//用户登录 string nickName = 1; string password = 2; }