// Path: src/main/java/org/projectnyx/network/mcpe/ReceivedPacket.java
// public abstract class ReceivedPacket extends ByteBufferReader implements Cloneable {
//     public void parse(ByteBuffer buffer) {
//         this.buffer = buffer;
//         buffer.order(ByteOrder.BIG_ENDIAN);
// 
//         decode();
//     }
// 
//     public abstract byte getId();
// 
//     protected abstract void decode();
// 
//     @SneakyThrows(CloneNotSupportedException.class)
//     public ReceivedPacket getClone() {
//         return (ReceivedPacket) clone();
//     }
// }


import java.nio.ByteBuffer;
import org.projectnyx.network.mcpe.ReceivedPacket;
/*
 * Nyx - Server software for Minecraft: PE and more
 * Copyright © boredphoton 2016
 *
 * 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 org.projectnyx.network.mcpe.raknet;



public class RawDataPacket {
    public final static byte RELIABILITY_UNRELIABLE = (byte) 0x00;
    public final static byte RELIABILITY_UNRELIABLE_SEQUENCED = (byte) 0x01;
    public final static byte RELIABILITY_RELIABLE = (byte) 0x02;
    public final static byte RELIABILITY_RELIABLE_ORDERED = (byte) 0x03;
    public final static byte RELIABILITY_RELIABLE_SEQUENCED = (byte) 0x04;
    public final static byte RELIABILITY_UNRELIABLE_WITH_ACK_RECEIPT = (byte) 0x05;
    public final static byte RELIABILITY_UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT = (byte) 0x06;
    public final static byte RELIABILITY_RELIABLE_WITH_ACK_RECEIPT = (byte) 0x07;
    public final static byte RELIABILITY_RELIABLE_ORDERED_WITH_ACK_RECEIPT = (byte) 0x08;
    public final static byte RELIABILITY_RELIABLE_SEQUENCED_WITH_ACK_RECEIPT = (byte) 0x09;

    public byte[] buffer;
    public byte reliability;
    public boolean hasSplit;
    public int orderIndex;
    public int messageIndex;
    public byte orderChannel;
    public int splitCount;
    public short splitId;
    public int splitIndex;

// Path: src/main/java/org/projectnyx/network/mcpe/ReceivedPacket.java
// public abstract class ReceivedPacket extends ByteBufferReader implements Cloneable {
//     public void parse(ByteBuffer buffer) {
//         this.buffer = buffer;
//         buffer.order(ByteOrder.BIG_ENDIAN);
// 
//         decode();
//     }
// 
//     public abstract byte getId();
// 
//     protected abstract void decode();
// 
//     @SneakyThrows(CloneNotSupportedException.class)
//     public ReceivedPacket getClone() {
//         return (ReceivedPacket) clone();
//     }
// }


// Path: src/main/java/org/projectnyx/network/mcpe/raknet/RawDataPacket.java
import java.nio.ByteBuffer;
import org.projectnyx.network.mcpe.ReceivedPacket;

/*
 * Nyx - Server software for Minecraft: PE and more
 * Copyright © boredphoton 2016
 *
 * 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 org.projectnyx.network.mcpe.raknet;



public class RawDataPacket {
    public final static byte RELIABILITY_UNRELIABLE = (byte) 0x00;
    public final static byte RELIABILITY_UNRELIABLE_SEQUENCED = (byte) 0x01;
    public final static byte RELIABILITY_RELIABLE = (byte) 0x02;
    public final static byte RELIABILITY_RELIABLE_ORDERED = (byte) 0x03;
    public final static byte RELIABILITY_RELIABLE_SEQUENCED = (byte) 0x04;
    public final static byte RELIABILITY_UNRELIABLE_WITH_ACK_RECEIPT = (byte) 0x05;
    public final static byte RELIABILITY_UNRELIABLE_SEQUENCED_WITH_ACK_RECEIPT = (byte) 0x06;
    public final static byte RELIABILITY_RELIABLE_WITH_ACK_RECEIPT = (byte) 0x07;
    public final static byte RELIABILITY_RELIABLE_ORDERED_WITH_ACK_RECEIPT = (byte) 0x08;
    public final static byte RELIABILITY_RELIABLE_SEQUENCED_WITH_ACK_RECEIPT = (byte) 0x09;

    public byte[] buffer;
    public byte reliability;
    public boolean hasSplit;
    public int orderIndex;
    public int messageIndex;
    public byte orderChannel;
    public int splitCount;
    public short splitId;
    public int splitIndex;

    public static RawDataPacket read(ReceivedPacket packet) {