bit manipulation - Write protocol headers in little endian to wire - Clean approach in Java? -


i'm experimenting quic example server chromium project, i'm trying implement simple java client speaks quic.

how program header fields (quic defined in little-endian)? i'm throwing around byte-arrays , bitwise operators feels there should lot cleaner way this. libraries allow me set bits in header , stuff that?

greetings

you can use bytebuffer , define little-endian:

bytebuffer buffer = ... buffer.order(byteorder.little_endian); 

then can call putint(value) put integer values using byte ordering want , later retrieve bytes , send them on merry way.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -