<commit_before>package sivl.platform.file.cmd;

import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

import sivl.platform.file.demo.data.GroupInfo;
import sivl.platform.file.model.FileGroupInfoModel;
import sivl.platform.file.model.FileResultModel;

/**
 * 分组信息命令
 * 目的：
 * @author lixuefeng
 * @date 2016年1月7日
 * @version 1.0
 */
public class GroupInfoCmd extends AbstractCmd<List<FileGroupInfoModel>> {

	public GroupInfoCmd() {
		super();
		this.requestCmd = TRACKER_PROTO_CMD_SERVER_LIST_GROUP;
		this.responseCmd = TRACKER_PROTO_CMD_RESP;
		this.responseSize = -1;
	}
	
	@Override
	public FileResultModel<List<FileGroupInfoModel>> exec(Socket socket) throws IOException {
		request(socket.getOutputStream());
		Response response = response(socket.getInputStream());
		if(response.isSuccess()){
			byte[] data = response.getData();
			int dataLength = data.length;
			if(dataLength%GroupInfo.BYTE_SIZE!=0){
				throw new IOException("recv body length: " + data.length + " is not correct");
			}
			List<FileGroupInfoModel> groupInfos = new ArrayList<FileGroupInfoModel>();
			int offset = 0;
			while(offset<dataLength){
				FileGroupInfoModel groupInfo = new FileGroupInfoModel(data,offset);
				groupInfos.add(groupInfo);
				offset += GroupInfo.BYTE_SIZE;
			}
			return new FileResultModel<List<FileGroupInfoModel>>(response.getCode(),groupInfos);
		}else{<commit_msg>分布式文件系统<commit_after>package sivl.platform.file.cmd;

import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

import sivl.platform.file.model.FileGroupInfoModel;
import sivl.platform.file.model.FileResultModel;

/**
 * 分组信息命令
 * 目的：
 * @author lixuefeng
 * @date 2016年1月7日
 * @version 1.0
 */
public class GroupInfoCmd extends AbstractCmd<List<FileGroupInfoModel>> {

	public GroupInfoCmd() {
		super();
		this.requestCmd = TRACKER_PROTO_CMD_SERVER_LIST_GROUP;
		this.responseCmd = TRACKER_PROTO_CMD_RESP;
		this.responseSize = -1;
	}
	
	@Override
	public FileResultModel<List<FileGroupInfoModel>> exec(Socket socket) throws IOException {
		request(socket.getOutputStream());
		Response response = response(socket.getInputStream());
		if(response.isSuccess()){
			byte[] data = response.getData();
			int dataLength = data.length;
			if(dataLength%FileGroupInfoModel.BYTE_SIZE!=0){
				throw new IOException("recv body length: " + data.length + " is not correct");
			}
			List<FileGroupInfoModel> groupInfos = new ArrayList<FileGroupInfoModel>();
			int offset = 0;
			while(offset<dataLength){
				FileGroupInfoModel groupInfo = new FileGroupInfoModel(data,offset);
				groupInfos.add(groupInfo);
				offset += FileGroupInfoModel.BYTE_SIZE;
			}
			return new FileResultModel<List<FileGroupInfoModel>>(response.getCode(),groupInfos);
		}else{
{'fraction_non_alphanumeric': 0.11777225966654842, 'fraction_numerical': 0.007804185881518269, 'mean_word_length': 5.294642857142857, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5327780', 'n_tokens_mistral': 1006, 'n_tokens_neox': 918, 'n_words': 167}