update project structure

This commit is contained in:
Him188moe 2019-08-08 21:42:58 +08:00
parent f71ae87f09
commit 2f2b175153
6 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package net.mamoe.mirai.network;
/**
* @author Him188moe @ Mirai Project
*/
public class BinaryStream {
}

View File

@ -0,0 +1,8 @@
package net.mamoe.mirai.network.packet;
/**
* @author Him188moe @ Mirai Project
*/
public interface Packet {
}

View File

@ -0,0 +1,11 @@
package net.mamoe.mirai.network.packet;
/**
* @author Him188moe @ Mirai Project
*/
public @interface PacketId {
/**
* 获取用于识别的包 ID
*/
int value();
}

View File

@ -0,0 +1,14 @@
package net.mamoe.mirai.network.packet.client;
import net.mamoe.mirai.network.packet.PacketId;
/**
* @author Him188moe @ Mirai Project
*/
@PacketId(5)
public class ClientLoginPacket extends ClientPacket {
@Override
public void encode() {
}
}

View File

@ -0,0 +1,24 @@
package net.mamoe.mirai.network.packet.client;
import net.mamoe.mirai.network.packet.Packet;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
/**
* @author Him188moe @ Mirai Project
*/
public abstract class ClientPacket extends DataOutputStream implements Packet {
public ClientPacket() {
super(new ByteArrayOutputStream());
}
public long readQQ() {
}
/**
* Encode this packet
*/
public abstract void encode();
}

View File

@ -0,0 +1,23 @@
package net.mamoe.mirai.network.packet.server;
import net.mamoe.mirai.network.packet.Packet;
import org.jetbrains.annotations.NotNull;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.InputStream;
/**
* @author Him188moe @ Mirai Project
*/
public abstract class ServerPacket extends DataInputStream implements Packet {
public ServerPacket(@NotNull InputStream in) {
super(in);
}
public ServerPacket(@NotNull byte[] in) {
this(new ByteArrayInputStream(in));
}
public abstract void decode();
}