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

cn.nukkit.utils.PlayerDataSerializer Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Optional;
import java.util.UUID;

public interface PlayerDataSerializer {

    /**
     * Reads player data from {@link InputStream} if the file exists otherwise it will create the default data.
     *
     * @param name name of player or {@link UUID} as {@link String}
     * @param uuid uuid of player. Could be null if name is used.
     * @return {@link InputStream} if the player data exists
     */
    Optional read(String name, UUID uuid) throws IOException;

    /**
     * Writes player data to given {@link OutputStream}.
     *
     * @param name name of player or {@link UUID} as {@link String}
     * @param uuid uuid of player. Could be null if name is used.
     * @return stream to write player data
     */
    OutputStream write(String name, UUID uuid) throws IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy