Giter Site home page Giter Site logo

bytebuffer.js's Introduction

ByteBuffer.js

javascript字节流网络包封装类

1,字节流基本类型封装
2,long,int64类型实现
3,utf8编码实现

字节流打包:
var buffer=new ByteBuffer(128);
buffer.writeString("test string");
buffer.writeHex(0x04);
buffer.writeChar("|");
buffer.writeUint32(1000);
buffer.writeInt64(-14725836936900);
socket.send(buffer.buffer,buffer.offset);

字节流解包:
var len=socket.read(data);
var buffer=new ByteBuffer(len);
buffer.setBufferData(data);
var str=buffer.readString();
var int32=buffer.readInt32();

bytebuffer.js's People

Contributors

uther518 avatar

Stargazers

 avatar 小马哥nice avatar  avatar  avatar Alan avatar

Watchers

James Cloos avatar  avatar

bytebuffer.js's Issues

encode 方法

传入的byte必须要像下面这样
new Uint8Array(bytes)
转成TypedArray对象
才能进行按位运算吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.