当前位置: 首页 > news >正文

给装修公司做网站wordpress文章评论数

给装修公司做网站,wordpress文章评论数,网站前台和后台设计,wordpress导航栏颜色本章内容其实没有多大难度#xff0c;主要考察大家的细心程度.计算数据长度然后截取相应字节数组并按照协议进行解码#xff0c;编码则反之。 1.基础消息的编解码 Override public BasicMessage decode(byte[] bytes) {int dataLength ByteUtil.bytesToInt(ByteUtil.extra…本章内容其实没有多大难度主要考察大家的细心程度.计算数据长度然后截取相应字节数组并按照协议进行解码编码则反之。 1.基础消息的编解码 Override public BasicMessage decode(byte[] bytes) {int dataLength ByteUtil.bytesToInt(ByteUtil.extract(bytes, 2, 4));if (dataLength ! bytes.length) {throw new IllegalArgumentException(The data length is incorrect.);}return new BasicMessage().setRequest(RequestType.valueOfId(ByteUtil.extract(bytes, 0, 1)[0])).setResponse(ResponseType.valueOfId(ByteUtil.extract(bytes, 1, 1)[0])).setDataLength(dataLength).setPayload(ByteUtil.extract(bytes, 6, dataLength - 1 - 1 - 4 - 8)).setTimestamp(ByteUtil.bytesToLong(ByteUtil.extract(bytes, dataLength - 8, 8))); }Override public byte[] encode() {byte[] request new byte[]{this.getRequest().getId()};byte[] response new byte[]{this.getResponse().getId()};byte[] payload (null this.getPayload()) ? new byte[]{} : this.getPayload();byte[] timestamp ByteUtil.longToBytes(this.getTimestamp(), 8);byte[] dataLength ByteUtil.intToBytes(request.length response.length 4 payload.length timestamp.length, 4);return ByteUtil.concat(request,response,dataLength,payload,timestamp); }2.登入、登出消息的编解码 Override public Login decode(byte[] bytes) {return new Login().setLoginId(ByteUtil.bytesToShort(ByteUtil.extract(bytes, 0, 2))).setLoginInfo(new String(ByteUtil.extract(bytes, 2, bytes.length - 2), StandardCharsets.UTF_8)); }Override public byte[] encode() {return ByteUtil.concat(ByteUtil.shortToBytes(this.getLoginId(), 2),this.getLoginInfo().getBytes(StandardCharsets.UTF_8)); }Override public Logout decode(byte[] bytes) {return new Logout().setLogoutId(ByteUtil.bytesToShort(ByteUtil.extract(bytes, 0, 2))); }Override public byte[] encode() {return ByteUtil.concat(ByteUtil.shortToBytes(this.getLogoutId(), 2)); }3.上行、下行消息的编解码 Override public Upstream decode(byte[] bytes) {return new Upstream().setStatus(StatusType.valueOfId(ByteUtil.extract(bytes, 0, 1)[0])).setLongitude(ByteUtil.bytesToInt(ByteUtil.extract(bytes, 1, 4))).setLatitude(ByteUtil.bytesToInt(ByteUtil.extract(bytes, 5, 4))); }Override public byte[] encode() {return ByteUtil.concat(new byte[]{this.getStatus().getId()},ByteUtil.intToBytes(this.getLongitude(), 4),ByteUtil.intToBytes(this.getLatitude(), 4)); }Override public Downstream decode(byte[] bytes) {return new Downstream().setCommand(CommandType.valueOfId(ByteUtil.extract(bytes, 0, 1)[0])).setStatus(StatusType.valueOfId(ByteUtil.extract(bytes, 1, 1)[0])); }Override public byte[] encode() {return ByteUtil.concat(new byte[]{this.getCommand().getId()},new byte[]{this.getStatus().getId()}); }4.文件传输、文件下载的编解码 Override public FileTransfer decode(byte[] bytes) {int nameLength ByteUtil.bytesToInt(ByteUtil.extract(bytes, 0, 1));String filename new String(ByteUtil.extract(bytes, 1, nameLength), StandardCharsets.UTF_8);long id ByteUtil.bytesToLong(ByteUtil.extract(bytes, 1 nameLength, 8));int total ByteUtil.bytesToInt(ByteUtil.extract(bytes, 1 nameLength 8, 4));int index ByteUtil.bytesToInt(ByteUtil.extract(bytes, 1 nameLength 8 4, 4));int dataLength ByteUtil.bytesToInt(ByteUtil.extract(bytes, 1 nameLength 8 4 4, 4));byte[] content ByteUtil.extract(bytes, 1 nameLength 8 4 4 4, dataLength);int crc ByteUtil.crc(content, content.length);return new FileTransfer().setNameLength(nameLength).setFilename(filename).setId(id).setTotal(total).setIndex(index).setDataLength(dataLength).setContent(content).setCrc(crc); }Override public byte[] encode() {byte[] filename this.getFilename().getBytes(StandardCharsets.UTF_8);byte[] nameLength ByteUtil.intToBytes(filename.length, 1);byte[] id ByteUtil.longToBytes(this.getId(), 8);byte[] total ByteUtil.intToBytes(this.getTotal(), 4);byte[] index ByteUtil.intToBytes(this.getIndex(), 4);byte[] content this.getContent();byte[] dataLength ByteUtil.intToBytes(content.length, 4);byte[] crc ByteUtil.intToBytes(ByteUtil.crc(content, content.length), 1);return ByteUtil.concat(nameLength,filename,id,total,index,dataLength,content,crc); }Override public FileDownload decode(byte[] bytes) {int nameLength ByteUtil.bytesToInt(ByteUtil.extract(bytes, 0, 1));String filename new String(ByteUtil.extract(bytes, 1, nameLength), StandardCharsets.UTF_8);return new FileDownload().setNameLength(nameLength).setFilename(filename); }Override public byte[] encode() {byte[] filename this.getFilename().getBytes(StandardCharsets.UTF_8);byte[] nameLength ByteUtil.intToBytes(filename.length, 1);return ByteUtil.concat(nameLength,filename); }
http://www.dnsts.com.cn/news/188708.html

相关文章:

  • 网站建设维护工作总结闵行 网站建设公司
  • 旅游网站开发意义和背景河北城乡建设官方网站
  • 服装网站目标重庆产品网站建设
  • 外贸网站建设公司乐清案例上传网站
  • 免费网站源码建站系统怎样加强文化建设
  • 上海网站推广排名公司辽宁省营商环境建设局 网站
  • 深圳营销网站建设公司排名商务网站开发考卷
  • 南宁网站建公司网络营销心得体会800字
  • 宿州高端网站建设公司哪家好wordpress打不开仪表盘
  • php网站开发实训总结室内设计网站案例
  • wordpress自定义文章标题字体长沙seo行者seo09
  • 蓝众建站_专业网站建设杭州建站
  • 上海网络公司网站班级网站界面
  • 网站建设开发的规划流程wordpress插件 缩略图
  • 一个网站的制作步骤修改wordpress插件怎么用
  • 南京中小企业网站制作wordpress 评论id
  • 技术支持 昆明网站建设常德做网站公司
  • 在什么网站上做精帖iis 多网站安全设置
  • 网站下雪特效dw如何做网站界面
  • 九寨沟网站建设规划书网站怎样做反向链接
  • 昆山自适应网站建设用vue element-ui做的网站
  • 石家庄建立网站汉川市城乡建设局网站
  • 百度上公司做网站网站搭建设计 是什么意思
  • 厦门市住宅建设办公室网站南浔做网站
  • 网站设计摘要 优帮云百度保障中心人工电话
  • 网站建设平台硬件要求深圳住建招标网官网
  • 营销型网站建设哪家专业深圳网站制作大运软件小镇
  • 优化网站链接的方法网站建设公司广东
  • 完全免费网站源码企业网站推广的一般策略
  • 松岗做网站公司wordpress安装提示500错误