Moving from a String based approach?

I want to make my networking better. I’m working with the Netty API and I’ve written a Client/Server application that breaks apart a String that’s been sent over the network and figures things out. An example of my Login packet would look like this.

[1]Username@Password

Where [1] is the packet Id, and then the user/pass (all data, really) is split by the character ‘@’


out.build(176, player.getSession())
                .writeByte(recoveryChange, ValueType.C)
                .writeShort(messages, ValueType.A)
                .writeByte(memberWarning ? 1 : 0)
                .writeInt(lastLoginIP, ByteOrder.INVERSE_MIDDLE)
                .writeShort(lastLogin);
        out.sendPacket();

Here is an example of what I’m looking for. Something that creates a packet like such. I’ve been looking and looking, and I have a github for a server project that uses this type of networking, but I don’t understand it. I’m looking more so on tutorials/documentation for this.