Subversion Repositories programming

Rev

Rev 215 | Rev 218 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 215 Rev 216
Line 109... Line 109...
109
        packet[i+4] = packetEnd;
109
        packet[i+4] = packetEnd;
110
 
110
 
111
        return packet;
111
        return packet;
112
    }
112
    }
113
 
113
 
-
 
114
    public static byte[] createPacket (byte type, byte[] data, int packetNum)
-
 
115
    {
-
 
116
        int i;
-
 
117
        byte[] packet = new byte[data.length+5];
-
 
118
 
-
 
119
        packet[0] = packetBegin;
-
 
120
        packet[1] = type;
-
 
121
        packet[2] = (byte)packetNum;
-
 
122
        packet[3] = (byte)data.length;
-
 
123
 
-
 
124
        for (i=0; i<data.length; i++)
-
 
125
            packet[i+4] = data[i];
-
 
126
 
-
 
127
        packet[i+4] = packetEnd;
-
 
128
 
-
 
129
        return packet;
-
 
130
    }
-
 
131
    
114
    /**
132
    /**
115
     * Method: toString()
133
     * Method: toString()
116
     * Purpose: Convert a P2_Packet into a string for printing by a
134
     * Purpose: Convert a P2_Packet into a string for printing by a
117
     * PrintStream object.
135
     * PrintStream object.
118
     */
136
     */