code: 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
          );
      }
docs: Reads a Packet from raw input data
  @param in DataInputStream to fromStream from
  @return Packet created from input
  @throws IOException when unable to read from stream