public static byte[] packHeader(byte cmd,long pkg_len,byte errno) throws UnsupportedEncodingException {
  byte[] header;
  byte[] hex_len;
  header=new byte[FDFS_PROTO_PKG_LEN_SIZE + 2];
  Arrays.fill(header,(byte)0);
  hex_len=ProtoCommon.long2buff(pkg_len);
  System.arraycopy(hex_len,0,header,0,hex_len.length);
  header[PROTO_HEADER_CMD_INDEX]=cmd;
  header[PROTO_HEADER_STATUS_INDEX]=errno;
  return header;
}

public static byte [ ] packHeader ( byte cmd , long pkg_len , byte errno ) throws UnsupportedEncodingException { byte [ ] header ; byte [ ] hex_len ; header = new byte [ FDFS_PROTO_PKG_LEN_SIZE + 2 ] ; Arrays . fill ( header , ( byte ) 0 ) ; hex_len = ProtoCommon . long2buff ( pkg_len ) ; System . arraycopy ( hex_len , 0 , header , 0 , hex_len . length ) ; header [ PROTO_HEADER_CMD_INDEX ] = cmd ; header [ PROTO_HEADER_STATUS_INDEX ] = errno ; return header ; }
pack header by fastdfs transfer protocol
