sea-boat / mysql-protocol Goto Github PK
View Code? Open in Web Editor NEWa lib for mysql protocol operation
a lib for mysql protocol operation
还有RowDataPacket,作者继续加油!
ResultsetPacket有提供吗?好像包还不是很全哦。作者加油
public static final void writeUB3(ByteBuffer buffer, int i) {
buffer.put((byte) (i & 0xff));
buffer.put((byte) (i >>> 8));
buffer.put((byte) (i >>> 16));
}
不明白,为什么int转为byte类型还需要用 i&0xff呢?
我的理解是因为(byte)的强制转化是针对int类型的低8位的,所以就算i没有进行 &0xff的操作,也是不会影响到该值的吧。
所以高字节的int转低字节的byte是不是可以写成:
public static final void writeUB3(ByteBuffer buffer, int i) {
buffer.put((byte) (i) );
buffer.put((byte) (i >> 8));
buffer.put((byte) (i >> 16));
}
请问我现在捕获到了mysql的通讯数据包,mysql-protocl怎么用
public static final void writeLong(ByteBuffer buffer, long l) {
buffer.put((byte) (l & 0xff));
buffer.put((byte) (l >>> 8));
buffer.put((byte) (l >>> 16));
buffer.put((byte) (l >>> 24));
buffer.put((byte) (l >>> 32));
buffer.put((byte) (l >>> 40));
buffer.put((byte) (l >>> 48));
buffer.put((byte) (l >>> 56));
}
举这个方法的列子,为什么使用这些移位操作,比较疑惑。为什么是8 16 24 32 40 48 56,谢谢。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.