2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.lifx.internal.dto;
15 import java.nio.ByteBuffer;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * A packet handler responsible for converting a ByteBuffer into a Packet
23 * @param <T> the generic packet type
25 * @author Tim Buckley - Initial contribution
26 * @author Karel Goderis - Enhancement for the V2 LIFX Firmware and LAN Protocol Specification
29 public interface PacketHandler<T extends Packet> {
32 * Creates a packet from the given buffer.
34 * @param buf the buffer used for creating the packet
35 * @return the packet created from the buffer
36 * @throws IllegalArgumentException when an empty packet could not be created or the data in the buffer
39 public abstract T handle(ByteBuffer buf);