com.ibasco.agql.core.PacketEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of agql-lib-core Show documentation
Show all versions of agql-lib-core Show documentation
The core library. Required by all agql modules.
/*
* Copyright (c) 2022 Asynchronous Game Query Library
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibasco.agql.core;
import com.ibasco.agql.core.exceptions.PacketEncodeException;
import io.netty.buffer.ByteBuf;
/**
* Encodes {@link com.ibasco.agql.core.Packet} instances it's {@link io.netty.buffer.ByteBuf} representation.
*
* @param
* The type of {@link com.ibasco.agql.core.Packet}
*
* @author Rafael Luis Ibasco
*/
@FunctionalInterface
public interface PacketEncoder
{
/**
* Encodes a {@link com.ibasco.agql.core.Packet} into a {@link io.netty.buffer.ByteBuf}
*
* @param packet
* The {@link com.ibasco.agql.core.Packet} to be encoded
*
* @return The encoded {@link io.netty.buffer.ByteBuf}
*
* @throws com.ibasco.agql.core.exceptions.PacketEncodeException
* When an error occurs during the encoding process
*/
ByteBuf encode(P packet) throws PacketEncodeException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy