封装只有fileId的包，下载和删除文件时使用
@param command
@param group
@param filename
@param charset
345992
function(command, group, filename, charset) {
        // --------- 封装header
        var fnLength = Buffer.byteLength(filename, charset)
        var bodyLength = protocol.FDFS_GROUP_NAME_MAX_LEN + fnLength
        var header = protocol.packHeader(command, bodyLength, 0)

        // --------- 封装body
        var body = new Buffer(bodyLength)
        // 默认都填充上0
        body.fill(0)
        var groupBL = Buffer.byteLength(group, charset)
        body.write(group, 0, groupBL, charset)
        body.write(filename, protocol.FDFS_GROUP_NAME_MAX_LEN, fnLength, charset)

        return Buffer.concat([header, body])
    }
490489
@Override
    public boolean save(String content, Charset charset, String location) {
        File file = new File(location);
        try {
            Files.writeToFile(file, content, charset);
        } catch (IOException ex) {
            return false;
        }
        return true;
    }
934363
@Override
  public Object execute(@Nonnull final CommandContext context) throws Exception {
    log.debug("Changing group to: {}", name);
    context.getVariables().set(VariableNames.SHELL_GROUP, name);
    return null;
  }
962232
public static boolean setStringsWithGroup(String groupName,Map<String, Object> keyValueMap){
		if(keyValueMap == null || keyValueMap.isEmpty())return false;
		String[] keysValues = new String[keyValueMap.size() * 2];
		int index = 0;
		for (String key : keyValueMap.keySet()) {
			if(keyValueMap.get(key) == null)continue;
			keysValues[index++] = key;
			keysValues[index++] = keyValueMap.get(key).toString();
		}
		try {			
			if(JedisProviderFactory.isCluster(groupName)){
				return JedisProviderFactory.getMultiKeyJedisClusterCommands(groupName).mset(keysValues).equals(RESP_OK);
			}else{
				return JedisProviderFactory.getMultiKeyCommands(groupName).mset(keysValues).equals(RESP_OK);
			}
		} finally {
			JedisProviderFactory.getJedisProvider(groupName).release();
		}
	}
524756
public static String readFile(String fileName, String charset) {
        FileInputStream in = null;
        try {
            in = new FileInputStream(fileName);
            return read(in, charset);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            closeQuietly(in);
        }
    }
1046832
public void setGroup( final CharSequence group) {
		if ( group != null) format.getHeader().createEntry( GROUP, group);
	}
1182598
public static List<String> cmd(String command) throws IOException, InterruptedException {
        return cmd(command.split(" "));
    }
229621
function addParamGroups(command) {
  Object.defineProperty(command, 'paramGroups', {
    get: function() {
      var paramGroups = {};
      this.params.forEach(function(param) {
        var groupName = param.option || l10n.lookup('canonDefaultGroupName');
        if (paramGroups[groupName] == null) {
          paramGroups[groupName] = [];
        }
        paramGroups[groupName].push(param);
      });
      return paramGroups;
    },
    enumerable: true
  });
}
363092
public static final void setGroup(String name, Path... files) throws IOException
    {
        if (supports("posix"))
        {
            for (Path file : files)
            {
                FileSystem fs = file.getFileSystem();
                UserPrincipalLookupService upls = fs.getUserPrincipalLookupService();
                GroupPrincipal group = upls.lookupPrincipalByGroupName(name);
                PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class);
                view.setGroup(group);
            }
        }
        else
        {
            JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name);
        }
    }
390660
private void handleFile(final InputGroup group) {
    // Register a group start handler. The start handler will be called
    // with the file name. Then we can open the file.
    group.startHandler(new Handler<String>() {
      @Override
      public void handle(String fileName) {
        final File file = new File(tempDir, String.format("temp-%s-%s", UUID.randomUUID().toString(), fileName));
        input.vertx().fileSystem().open(file.getAbsolutePath(), new Handler<AsyncResult<AsyncFile>>() {
          @Override
          public void handle(AsyncResult<AsyncFile> result) {
            if (result.succeeded()) {
              handleFile(file.getAbsolutePath(), result.result(), group);
            } else if (exceptionHandler != null) {
              exceptionHandler.handle(result.cause());
            }
          }
        });
      }
    });
  }
1057093
@CommandArgument
  public void load(
      @OptionArgument("filename") String filename) {

    users.clear();

    try {
      BufferedReader reader = new BufferedReader(new FileReader(filename));

      while (reader.ready()) {
        User user = User.fromString(reader.readLine());
        users.put(user.username, user);
      }
    } catch (FileNotFoundException e) {
      System.err.println(String.format("File not found: '%s'", filename));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
1320957
public static String fileToString(String fileName, String charsetName) {
		return fileToString(new File(fileName), charsetName);
	}
939361
public static String exec(Session session, String cmd, Charset charset, OutputStream errStream) {
		if (null == charset) {
			charset = CharsetUtil.CHARSET_UTF_8;
		}
		ChannelExec channel = (ChannelExec) openChannel(session, ChannelType.EXEC);
		channel.setCommand(StrUtil.bytes(cmd, charset));
		channel.setInputStream(null);
		channel.setErrStream(errStream);
		InputStream in = null;
		try {
			in = channel.getInputStream();
			return IoUtil.read(in, CharsetUtil.CHARSET_UTF_8);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		} finally {
			IoUtil.close(in);
			close(channel);
		}
	}
294829
public static String readString(File targetFile, String charsetName) {
        return readString(targetFile.toPath(), charsetName);
    }
85144
protected static String runCommand(String... command) {
		try {
			final Process p = Runtime.getRuntime().exec(command);
			if (p == null) {
				return null;
			}
			final StringBuilder bStr = new StringBuilder();
			try (InputStream standardOutput = p.getInputStream()) {
				final byte[] buffer = new byte[BUFFER_SIZE];
				int len;
				while ((len = standardOutput.read(buffer)) > 0) {
					bStr.append(new String(buffer, 0, len));
				}
				p.waitFor();
				return bStr.toString();
			}
		} catch (Exception e) {
			return null;
		}
	}
957834
protected void send(OutputStream out, Charset charset) throws IOException {
        // 报文分为三个部分
        // 报文头
        byte[] head = request.getHeadByte(charset);
        // 交易参数
        byte[] param = request.encodeParam(charset);
        // 交易文件流
        InputStream inputFile = request.getInputFile();
        long fileSize = request.getFileSize();
        LOGGER.debug("发出交易请求..报文头为{}", request.getHead());
        LOGGER.debug("交易参数为{}", param);
        // 输出报文头
        out.write(head);
        // 输出交易参数
        if (null != param) {
            out.write(param);
        }
        // 输出文件流
        if (null != inputFile) {
            sendFileContent(inputFile, fileSize, out);
        }
    }
94966
public static void saveAsFile(String data, String charset, String addr) throws IOException {
        charset = StringUtils.isEmpty(charset) ? "UTF8" : charset;
        saveAsFile(data.getBytes(charset), addr);
    }