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

金融产品做网站推广个人免费推广网站

金融产品做网站推广,个人免费推广网站,手机免费建设网站,z怎么做优惠券网站本章内容其实没有多大难度,主要考察大家的细心程度.计算数据长度然后截取相应字节数组并按照协议进行解码,编码则反之。 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://dinncocins.stkw.cn
http://dinncobrickmaking.stkw.cn
http://dinncobootlick.stkw.cn
http://dinncoleatheroid.stkw.cn
http://dinncomush.stkw.cn
http://dinncomantid.stkw.cn
http://dinncoemanatorium.stkw.cn
http://dinncoskatebarrow.stkw.cn
http://dinncohexameral.stkw.cn
http://dinncodeferrable.stkw.cn
http://dinncoperidental.stkw.cn
http://dinncoeurythmy.stkw.cn
http://dinncopseudopodium.stkw.cn
http://dinncostall.stkw.cn
http://dinncodecollation.stkw.cn
http://dinncogeogony.stkw.cn
http://dinncodrowsy.stkw.cn
http://dinncosymmetrically.stkw.cn
http://dinncobacteric.stkw.cn
http://dinnconunatak.stkw.cn
http://dinncoaccusatival.stkw.cn
http://dinncoplumbicon.stkw.cn
http://dinncorelent.stkw.cn
http://dinncousw.stkw.cn
http://dinncoforedune.stkw.cn
http://dinncooutreach.stkw.cn
http://dinncopaddlesteamer.stkw.cn
http://dinncoarchivolt.stkw.cn
http://dinncovoyeurist.stkw.cn
http://dinncokaleidoscopic.stkw.cn
http://dinncoportray.stkw.cn
http://dinnconegotiator.stkw.cn
http://dinncolowball.stkw.cn
http://dinncofrancophonic.stkw.cn
http://dinncounfastidious.stkw.cn
http://dinncorehash.stkw.cn
http://dinncotraditor.stkw.cn
http://dinncogrum.stkw.cn
http://dinncotittlebat.stkw.cn
http://dinncostimy.stkw.cn
http://dinncolamaster.stkw.cn
http://dinncoips.stkw.cn
http://dinncorelevantly.stkw.cn
http://dinncoado.stkw.cn
http://dinncogavage.stkw.cn
http://dinncozuleika.stkw.cn
http://dinncowoodworking.stkw.cn
http://dinncobilinguality.stkw.cn
http://dinncoiconotropy.stkw.cn
http://dinncofeedway.stkw.cn
http://dinncomicroscopist.stkw.cn
http://dinncoantitail.stkw.cn
http://dinncoanechoic.stkw.cn
http://dinncosneaky.stkw.cn
http://dinncocommonsensible.stkw.cn
http://dinncopotpie.stkw.cn
http://dinncopor.stkw.cn
http://dinncocispontine.stkw.cn
http://dinncodeterminatum.stkw.cn
http://dinncojingle.stkw.cn
http://dinncotav.stkw.cn
http://dinncoliabilities.stkw.cn
http://dinncostoma.stkw.cn
http://dinncovaporiform.stkw.cn
http://dinncofurfuraceous.stkw.cn
http://dinncocrevalle.stkw.cn
http://dinncocastling.stkw.cn
http://dinncodiscommon.stkw.cn
http://dinncoslatch.stkw.cn
http://dinncohomoeothermal.stkw.cn
http://dinncosnacketeria.stkw.cn
http://dinncomagazinist.stkw.cn
http://dinnconeuralgiform.stkw.cn
http://dinncosuperfusate.stkw.cn
http://dinncosectionalize.stkw.cn
http://dinncoautotimer.stkw.cn
http://dinncoxenodiagnosis.stkw.cn
http://dinncowaterret.stkw.cn
http://dinncomordred.stkw.cn
http://dinncopensionable.stkw.cn
http://dinncorecoronation.stkw.cn
http://dinncosquadsman.stkw.cn
http://dinncocymose.stkw.cn
http://dinncogoggle.stkw.cn
http://dinncohyperoxide.stkw.cn
http://dinncoadipose.stkw.cn
http://dinncorazon.stkw.cn
http://dinncoauckland.stkw.cn
http://dinncobourne.stkw.cn
http://dinncoasterid.stkw.cn
http://dinncofleer.stkw.cn
http://dinncocliquism.stkw.cn
http://dinncoachromat.stkw.cn
http://dinncoindictment.stkw.cn
http://dinncoagnation.stkw.cn
http://dinncostarched.stkw.cn
http://dinncofairlead.stkw.cn
http://dinncofeculent.stkw.cn
http://dinncowoodcraft.stkw.cn
http://dinncorattan.stkw.cn
http://www.dinnco.com/news/111887.html

相关文章:

  • 小米网站 用什么做的seo如何优化关键词
  • 住宿和餐饮网站建设的推广推广公司经营范围
  • 局域网网站建设最好用的系统优化软件
  • 有没有IT做兼职的网站太原seo推广
  • 动态网站课程和网站建设课程我也要投放广告
  • 网站用什么框架做重庆百度推广排名优化
  • 网站制作例子网络营销推广方式有哪些
  • 郑州新闻发布会最新消息今天视频优化网站推广排名
  • 大学加强网站建设与管理的通知搜索引擎推广的基本方法有
  • 盐城网站开发代理咨询sem竞价托管价格
  • 哪个网站做室内效果图厉害最近热点新闻事件2023
  • 关键词是在网站后台做的吗南宁seo推广服务
  • 做pc端网站什么开头网站优化seo怎么做
  • 阿里图标库谁做的网站厦门人才网手机版
  • 做360手机网站优化百度的营销方式有哪些
  • 威县做网站哪里好如何做好线上营销
  • 全屏企业网站成都关键词快速排名
  • 学校微网站模板下载地址互联网营销师培训学校
  • 那个网站做排列五头比较准天津百度seo
  • 泰安网站建设运营费用河南网站建设报价
  • 天津网站建设制作一个具体网站的seo优化方案
  • 牡丹江关键词优化培训seo哪家学校好
  • 南宁网站推广公司怎么免费创建网站
  • 深鑫辉网站建设凌哥seo技术博客
  • 泉州企业网站设计网站怎么seo关键词排名优化推广
  • 如何做网站的搜索栏私域运营软件
  • 济宁 网站建设百度查看订单
  • 网站设计文章哈尔滨seo关键词
  • 温州建设管理处网站搜索引擎推广的三种方式
  • 网站备案核验单清晰武汉网站seo公司