Skip to content

An easy to use defined bytebuf reader inspired from Mojang's DataFixerUpper serialization Codecs

License

Notifications You must be signed in to change notification settings

Team-Resourceful/ByteCodecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ByteCodecs

An easy to use defined netty bytebuf reader and writer inspired from Mojang's DataFixerUpper serialization Codecs.

Example

    public record ExampleCodecObject(int anInt, String aString, boolean aBoolean) {
        
        public static final ByteCodec<String> STRING_NO_SPACES = ByteCodec.STRING.map(String::strip, Function.identity());
        
        public static final ByteCodec<ExampleCodecObject> CODEC = ObjectByteCodec.create(
                ByteCodec.INT.fieldOf(ExampleCodecObject::anInt),
                STRING_NO_SPACES.fieldOf(ExampleCodecObject::aString),
                ByteCodec.BOOLEAN.fieldOf(ExampleCodecObject::aBoolean),
                ExampleCodecObject::new
        );
        
    }

About

An easy to use defined bytebuf reader inspired from Mojang's DataFixerUpper serialization Codecs

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages