CavalliumDBEngine/src/main/java/it/cavallium/dbengine/database/remote/PathSerializer.java

22 lines
586 B
Java
Raw Normal View History

2022-03-02 12:34:30 +01:00
package it.cavallium.dbengine.database.remote;
import it.cavallium.data.generator.DataSerializer;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.nio.file.Path;
import org.jetbrains.annotations.NotNull;
public class PathSerializer implements DataSerializer<Path> {
@Override
public void serialize(DataOutput dataOutput, @NotNull Path path) throws IOException {
dataOutput.writeUTF(path.toString());
}
@Override
public @NotNull Path deserialize(DataInput dataInput) throws IOException {
return Path.of(dataInput.readUTF());
}
}