All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.mayuna.timestop.networking.base.serialization.UUIDSerializer Maven / Gradle / Ivy

package dev.mayuna.timestop.networking.base.serialization;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;

import java.util.UUID;

/**
 * Serializer for UUIDs
 */
public class UUIDSerializer extends Serializer {

    @Override
    public void write(Kryo kryo, Output output, UUID object) {
        output.writeLong(object.getMostSignificantBits());
        output.writeLong(object.getLeastSignificantBits());
    }

    @Override
    public UUID read(Kryo kryo, Input input, Class type) {
        return new UUID(input.readLong(), input.readLong());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy