public static Packet fromStream ( final DataInputStream in ) throws IOException { // Packet Type final Packet . PacketType packetType = Packet . PacketType . fastValues [ in . readByte ( ) ] ; // Packet ID final short packetID = in . readShort ( ) ; // Data Length final int dataLength = in . readInt ( ) ; // Data final byte [ ] data = new byte [ dataLength ] ; in . readFully ( data ) ; return new Packet ( packetType , packetID , data ) ; }
Reads a Packet from raw input data