com.sun.enterprise.util.io.FileUtils.makeForwardSlashes()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中com.sun.enterprise.util.io.FileUtils.makeForwardSlashes()方法的一些代码示例,展示了FileUtils.makeForwardSlashes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.makeForwardSlashes()方法的具体详情如下:
包路径:com.sun.enterprise.util.io.FileUtils
类名称:FileUtils
方法名:makeForwardSlashes

FileUtils.makeForwardSlashes介绍

[英]Returns a String with uniform slashes such that all the occurances of '\' are replaced with '/'. In other words, the returned string will have all forward slashes. Accepts non-null strings only.
[中]返回一个带有统一斜杠的字符串,以便将“\”的所有出现项替换为“/”。换句话说,返回的字符串将具有所有正向斜杠。仅接受非空字符串。

代码示例

代码示例来源:origin: org.glassfish.main.admin/server-mgmt

protected String getFilePath(String propertyName) {
  File f = new File(propertyName);
  return FileUtils.makeForwardSlashes(f.getAbsolutePath());
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-cli

/**
 * This method first obtains a list of files under the product installation
 * directory. It then modifies each path by prepending it with remote install dir path.
 * For ex. glassfish/lib/appserv-rt.jar becomes
 * <remote-install-path>/glassfish/lib/appserv-rt.jar
 * @return List of files and directories
 * @throws IOException
 */
List<String> getListOfInstallFiles(String installDir) throws IOException {
  String ins = resolver.resolve("${com.sun.aas.productRoot}");
  Set files = FileUtils.getAllFilesAndDirectoriesUnder(new File(ins));
  if (logger.isLoggable(Level.FINER))
    logger.finer("Total number of files under " + ins + " = " +
                              files.size());
  String remoteDir = installDir;
  if (!installDir.endsWith("/")) {
    remoteDir = remoteDir + "/";
  }
  List<String> modList = new ArrayList<String>();
  for (Object f : files) {
    modList.add(remoteDir + FileUtils.makeForwardSlashes(((File) f).getPath()));
  }
  return modList;
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-admin

value = FileUtils.makeForwardSlashes(value);
configValue = FileUtils.makeForwardSlashes(configValue);

代码示例来源:origin: org.glassfish.main.admin/server-mgmt

/**
 * Creates a new instance of RepositoryConfig defined using the system
 * property com.sun.aas.instanceRoot. It is assumed that this system
 * property is a directory of the form:
 * <repositoryRootDirectory>/<repositoryName>/<instanceName>
 */
public RepositoryConfig(String instanceRootString) {
  final File instanceRoot = new File(instanceRootString);
  final File repositoryDir = instanceRoot.getParentFile();
  _instanceName = instanceRoot.getName();
  _repositoryName = repositoryDir.getName();
  _repositoryRoot = FileUtils.makeForwardSlashes(repositoryDir.getParentFile().getAbsolutePath());
  _configurationName = null;
  final Map<String, String> envProperties = getEnvProps();
  put(K_INSTALL_ROOT,
      envProperties.get(SystemPropertyConstants.INSTALL_ROOT_PROPERTY));
  put(K_CONFIG_ROOT,
      getFilePath(envProperties.get(SystemPropertyConstants.CONFIG_ROOT_PROPERTY)));
}

代码示例来源:origin: org.glassfish.cluster/cluster-admin

value = FileUtils.makeForwardSlashes(value);
configValue = FileUtils.makeForwardSlashes(configValue);

代码示例来源:origin: org.glassfish.main.admin/server-mgmt

substitutableTokens.put(INSTALL_ROOT_TOKEN_NAME,  domainConfig.getInstallRoot());
substitutableTokens.put(SERVER_ROOT,  FileUtils.makeForwardSlashes(domainConfig.getInstallRoot()));
substitutableTokens.put(SERVER_NAME,  domainConfig.get(DomainConfig.K_HOST_NAME).toString());
substitutableTokens.put(ORB_LISTENER1_PORT,  domainConfig.get(DomainConfig.K_ORB_LISTENER_PORT).toString());

相关文章