public byte[] getReqFileBytes() { byte[] buf = new byte[SIZE]; byte[] temp_int = null; // type temp_int = Utils.toLH(type); System.arraycopy(temp_int, 0, buf, 0, temp_int.length); // filename System.arraycopy(filename, 0, buf, 4, filename.length); // username System.arraycopy(username, 0, buf, 104, username.length); return buf; }
public ReqFile getReqFile(byte[] buf) { ReqFile p = new ReqFile(); byte[] temp = null; byte[] temp_int = new byte[4]; // type System.arraycopy(buf, 0, temp_int, 0, 4); p.type = Utils.vtolh(temp_int); // filename System.arraycopy(buf, 4, temp, 0, 100); p.filename = temp; // username System.arraycopy(buf, 104, temp, 0, 12); p.username = temp; return null; }