当前位置: 首页>>代码示例>>Java>>正文


Java File.pathSeparatorChar方法代码示例

本文整理汇总了Java中java.io.File.pathSeparatorChar方法的典型用法代码示例。如果您正苦于以下问题:Java File.pathSeparatorChar方法的具体用法?Java File.pathSeparatorChar怎么用?Java File.pathSeparatorChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.File的用法示例。


在下文中一共展示了File.pathSeparatorChar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setDir

import java.io.File; //导入方法依赖的package包/类
public void setDir (String dir, boolean clean) throws IOException {
    StringBuffer sb = new StringBuffer(dir);
    if (sb.charAt(sb.length()-1) != File.pathSeparatorChar) {
        sb.append (File.separatorChar);
    }
    this.dir = sb.toString();
    File f = new File (dir);
    if (!f.exists()) {
        f.mkdir();
    }
    if (clean) {
        File mf = new File (this.dir + filename + ".metadata");
        File fc = new File (this.dir + filename + ".cache");
        if (mf.exists()) {
            mf.delete();
        }
        if (fc.exists()) {
            fc.delete();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:CacheWriter.java

示例2: parseFileName

import java.io.File; //导入方法依赖的package包/类
private Path parseFileName() throws ProguardRuleParserException {
  skipWhitespace();
  int start = position;
  int end = position;
  while (!eof(end)) {
    char current = contents.charAt(end);
    if (current != File.pathSeparatorChar && !Character.isWhitespace(current)) {
      end++;
    } else {
      break;
    }
  }
  if (start == end) {
    throw parseError("File name expected");
  }
  position = end;
  return baseDirectory.resolve(contents.substring(start, end));
}
 
开发者ID:inferjay,项目名称:r8,代码行数:19,代码来源:ProguardConfigurationParser.java

示例3: isNormalisingRequiredForAbsolutePath

import java.io.File; //导入方法依赖的package包/类
boolean isNormalisingRequiredForAbsolutePath(String filePath) {
    if (File.pathSeparatorChar != '/') {
        filePath = filePath.replace(File.pathSeparatorChar, '/');
    }
    if (filePath.charAt(0) != '/') {
        throw new IllegalArgumentException("Only absolute unix paths are currently handled. filePath=" + filePath);
    }
    if (filePath.contains("/../") || filePath.contains("/./") || filePath.contains("//")) {
        return true;
    }
    if (filePath.endsWith("/") || filePath.endsWith("/.") || filePath.endsWith("/..")) {
        return true;
    }
    return false;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:FileNormaliser.java

示例4: getClassPath

import java.io.File; //导入方法依赖的package包/类
protected String getClassPath() {
    String bootclasspath;
    if (Java8OrEarlier) {
        bootclasspath = System.getProperty("sun.boot.class.path");
    } else {
        bootclasspath = System.getProperty("jdk.module.path") + File.pathSeparatorChar + System.getProperty("jdk.module.upgrade.path");
    }
    return bootclasspath;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:CheckGraalInvariants.java

示例5: createFileWithNewClustersForNbexec

import java.io.File; //导入方法依赖的package包/类
private static void createFileWithNewClustersForNbexec(File newCluster, String nbdirs, File udir) throws FileNotFoundException, IOException {
    newCluster.mkdirs();
    nbdirs = nbdirs + File.pathSeparatorChar + newCluster.getAbsolutePath();
    File fileWithClustersForShell = new File(udir, "update"+File.separatorChar+"download"+File.separatorChar+"netbeans.dirs");
    fileWithClustersForShell.getParentFile().mkdirs();
    fileWithClustersForShell.createNewFile();
    OutputStream os = new FileOutputStream(fileWithClustersForShell);
    os.write(nbdirs.getBytes());
    os.close();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NewClustersRebootCallback.java

示例6: testMVJarAsLib

import java.io.File; //导入方法依赖的package包/类
@Test(dataProvider = "jarFiles")
void testMVJarAsLib(String jar, int mainVer, int helperVer, int resVer)
        throws Throwable {
    String[] apps = { "UseByImport", "UseByReflection" };
    for (String app : apps) {
        String[] command = {"-cp",
                jar + File.pathSeparatorChar + "classes/test/", app };
        System.out.println("Command arguments:" + Arrays.asList(command));
        System.out.println();
        java(command).shouldHaveExitValue(SUCCESS)
                .shouldContain("Main version: " + mainVer)
                .shouldContain("Helpers version: " + helperVer)
                .shouldContain("Resource version: " + resVer);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:RuntimeTest.java

示例7: newClassLoader

import java.io.File; //导入方法依赖的package包/类
protected ClassLoader newClassLoader() throws MalformedURLException
{
  logger.debug("creating new loader");

  loader_cp = "";
  for (int i = 0; i < classPath.size(); i++) {
    loader_cp += classPath.get(i);
    loader_cp += File.pathSeparatorChar;
  }
  loader_cp += outDir;
  DynamicClassLoaderSimple cl = new DynamicClassLoaderSimple(ClassLoader.getSystemClassLoader());
  cl.addJars(classPath);
  cl.addDynamicDir(outDir);
  return cl;
}
 
开发者ID:twosigma,项目名称:beaker-notebook-archive,代码行数:16,代码来源:ScalaEvaluator.java

示例8: newAutoCompleteClassLoader

import java.io.File; //导入方法依赖的package包/类
protected ClassLoader newAutoCompleteClassLoader() throws MalformedURLException
{
  logger.debug("creating new autocomplete loader");
  acloader_cp = "";
  for (int i = 0; i < classPath.size(); i++) {
    acloader_cp += classPath.get(i);
    acloader_cp += File.pathSeparatorChar;
  }
  acloader_cp += outDir;
      
  DynamicClassLoaderSimple cl = new DynamicClassLoaderSimple(ClassLoader.getSystemClassLoader());
  cl.addJars(classPath);
  cl.addDynamicDir(outDir);
  return cl;
}
 
开发者ID:twosigma,项目名称:beaker-notebook-archive,代码行数:16,代码来源:ScalaEvaluator.java

示例9: isDelimiter

import java.io.File; //导入方法依赖的package包/类
private boolean isDelimiter(char character)
{
    return character == '@' ||
           character == '{' ||
           character == '}' ||
           character == '(' ||
           character == ')' ||
           character == ',' ||
           character == ';' ||
           character == File.pathSeparatorChar;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:WordReader.java

示例10: calculateRelativePath

import java.io.File; //导入方法依赖的package包/类
private static String calculateRelativePath(String uri, String base, boolean fileUrl) {
    // if this is a file URL (very likely), and if this is on a case-insensitive file system,
    // then treat it accordingly.
    boolean onWindows = File.pathSeparatorChar==';';

    if (base == null) {
        return null;
    }
    if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) {
        return uri.substring(base.length());
    } else {
        return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XmlSchemaGenerator.java

示例11: testUpdateCompilationUnits

import java.io.File; //导入方法依赖的package包/类
public void testUpdateCompilationUnits() throws Exception {
    List sources;
    List units = new ArrayList();
    List expectedUnits;
    
    ProjectModel pm = createEmptyProjectModel();
    
    sources = generateSources(new String[]{"src1", "src2"});
    JavaProjectGenerator.JavaCompilationUnit cu = new JavaProjectGenerator.JavaCompilationUnit();
    cu.packageRoots = Collections.singletonList("src1");
    JavaProjectGenerator.JavaCompilationUnit.CP cp = new JavaProjectGenerator.JavaCompilationUnit.CP();
    cp.classpath = "cp1"+File.pathSeparatorChar+"cp2";
    cp.mode = "compile";
    cu.classpath = Collections.singletonList(cp);
    cu.output = Arrays.asList(new String[]{"out1", "out2"});
    units.add(cu);
    cu = new JavaProjectGenerator.JavaCompilationUnit();
    cu.packageRoots = Collections.singletonList("src2");
    cp = new JavaProjectGenerator.JavaCompilationUnit.CP();
    cp.classpath = "cp2"+File.pathSeparatorChar+"cp3";
    cp.mode = "compile";
    cu.classpath = Collections.singletonList(cp);
    cu.output = Arrays.asList(new String[]{"out3"});
    units.add(cu);
    pm.setSourceFolders(sources);
    pm.setJavaCompilationUnits(units);
    pm.setSourceLevel("S_L_14");
    pm.updateCompilationUnits(false);
    assertEquals("Compilation units has to be merged into one", 1, units.size());
    cu = (JavaProjectGenerator.JavaCompilationUnit)units.get(0);
    assertEquals("Compilation unit has to have two package roots", 2, cu.packageRoots.size());
    assertTrue("Missing expected package root: src1", cu.packageRoots.contains("src1"));
    assertTrue("Missing expected package root: src2", cu.packageRoots.contains("src2"));
    assertEquals("Compilation unit has to have three classpath items", 
        "cp1"+File.pathSeparatorChar+"cp2"+File.pathSeparatorChar+"cp3", 
        cu.classpath.get(0).classpath);
    assertEquals("Compilation unit has to have three output items", 3, cu.output.size());
    assertTrue("Missing expected package root: out1", cu.output.contains("out1"));
    assertTrue("Missing expected package root: out2", cu.output.contains("out2"));
    assertTrue("Missing expected package root: out2", cu.output.contains("out2"));
    assertTrue("Missing expected source level: S_L_14", cu.sourceLevel.equals("S_L_14"));
    
    pm.setSourceFolders(sources);
    pm.setJavaCompilationUnits(units);
    pm.setSourceLevel("S_L_15");
    pm.updateCompilationUnits(true);
    assertEquals("Compilation units has to be cloned into two", 2, units.size());
    cu = (JavaProjectGenerator.JavaCompilationUnit)units.get(0);
    assertEquals("Compilation unit has to have one package root", 1, cu.packageRoots.size());
    assertTrue("Missing expected package root", cu.packageRoots.contains("src1"));
    assertEquals("Compilation unit has to have three classpath items", 
        "cp1"+File.pathSeparatorChar+"cp2"+File.pathSeparatorChar+"cp3", 
        cu.classpath.get(0).classpath);
    assertEquals("Compilation unit has to have three output items", 3, cu.output.size());
    assertTrue("Missing expected package root: out1", cu.output.contains("out1"));
    assertTrue("Missing expected package root: out2", cu.output.contains("out2"));
    assertTrue("Missing expected package root: out2", cu.output.contains("out2"));
    assertTrue("Missing expected source level: S_L_14", cu.sourceLevel.equals("S_L_15"));
    cu = (JavaProjectGenerator.JavaCompilationUnit)units.get(1);
    assertEquals("Compilation unit has to have one package root", 1, cu.packageRoots.size());
    assertTrue("Missing expected package root", cu.packageRoots.contains("src2"));
    assertEquals("Compilation unit has to have three classpath items", 
        "cp1"+File.pathSeparatorChar+"cp2"+File.pathSeparatorChar+"cp3", 
        cu.classpath.get(0).classpath);
    assertEquals("Compilation unit has to have three output items", 3, cu.output.size());
    assertTrue("Missing expected package root: out1", cu.output.contains("out1"));
    assertTrue("Missing expected package root: out2", cu.output.contains("out2"));
    assertTrue("Missing expected package root: out2", cu.output.contains("out2"));
    assertTrue("Missing expected source level: S_L_14", cu.sourceLevel.equals("S_L_15"));
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:72,代码来源:ProjectModelTest.java

示例12: getOperatingSystem

import java.io.File; //导入方法依赖的package包/类
/** Get the operating system on which NetBeans is running.
* @return one of the <code>OS_*</code> constants (such as {@link #OS_WINNT})
*/
public static int getOperatingSystem() {
    if (operatingSystem == -1) {
        String osName = System.getProperty("os.name");

        if ("Windows NT".equals(osName)) { // NOI18N
            operatingSystem = OS_WINNT;
        } else if ("Windows 95".equals(osName)) { // NOI18N
            operatingSystem = OS_WIN95;
        } else if ("Windows 98".equals(osName)) { // NOI18N
            operatingSystem = OS_WIN98;
        } else if ("Windows 2000".equals(osName)) { // NOI18N
            operatingSystem = OS_WIN2000;
        } else if ("Windows Vista".equals(osName)) { // NOI18N
            operatingSystem = OS_WINVISTA;
        } else if (osName.startsWith("Windows ")) { // NOI18N
            operatingSystem = OS_WIN_OTHER;
        } else if ("Solaris".equals(osName)) { // NOI18N
            operatingSystem = OS_SOLARIS;
        } else if (osName.startsWith("SunOS")) { // NOI18N
            operatingSystem = OS_SOLARIS;
        }
        // JDK 1.4 b2 defines os.name for me as "Redhat Linux" -jglick
        else if (osName.endsWith("Linux")) { // NOI18N
            operatingSystem = OS_LINUX;
        } else if ("HP-UX".equals(osName)) { // NOI18N
            operatingSystem = OS_HP;
        } else if ("AIX".equals(osName)) { // NOI18N
            operatingSystem = OS_AIX;
        } else if ("Irix".equals(osName)) { // NOI18N
            operatingSystem = OS_IRIX;
        } else if ("SunOS".equals(osName)) { // NOI18N
            operatingSystem = OS_SUNOS;
        } else if ("Digital UNIX".equals(osName)) { // NOI18N
            operatingSystem = OS_TRU64;
        } else if ("OS/2".equals(osName)) { // NOI18N
            operatingSystem = OS_OS2;
        } else if ("OpenVMS".equals(osName)) { // NOI18N
            operatingSystem = OS_VMS;
        } else if (osName.equals("Mac OS X")) { // NOI18N
            operatingSystem = OS_MAC;
        } else if (osName.startsWith("Darwin")) { // NOI18N
            operatingSystem = OS_MAC;
        } else if (osName.toLowerCase(Locale.US).startsWith("freebsd")) { // NOI18N 
            operatingSystem = OS_FREEBSD;
        } else if ("OpenBSD".equals(osName)) { // NOI18N
            operatingSystem = OS_OPENBSD;
        } else if (File.pathSeparatorChar == ':') { // NOI18N
            operatingSystem = OS_UNIX_OTHER;
        } else {
            operatingSystem = OS_OTHER;
        }
    }

    return operatingSystem;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:59,代码来源:BaseUtilities.java

示例13: isWindowsOS

import java.io.File; //导入方法依赖的package包/类
public static boolean isWindowsOS() {
    return File.pathSeparatorChar == ';';
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:OSUtils.java

示例14: startModelProcess

import java.io.File; //导入方法依赖的package包/类
/**
 * Creates and starts a server process that is capable of running the python
 * model with the given properties.
 */
private static Process startModelProcess(String host, int port, String pythonExecutable, File opendaPythonPath,
		File modelPythonPath, String modelPythonModuleName, String modelPythonClassName, File runDir)
		throws IOException {
	ProcessBuilder builder = new ProcessBuilder();
	builder.directory(runDir);
	//TODO Niels: use Result.putMessage(), otherwise log messages just disappear. AK
	LOGGER.info("Running process with current working directory " + runDir.getAbsolutePath());
	Results.putMessage("Running process with current working directory " + runDir.getAbsolutePath());

	// add openda python code and model python code to python path.
	char pathSeparatorChar = File.pathSeparatorChar;
	String currentPythonPath = builder.environment().get("PYTHONPATH");
	String newPythonPath = opendaPythonPath.getAbsolutePath() + pathSeparatorChar
			+ modelPythonPath.getAbsolutePath() + pathSeparatorChar + currentPythonPath;
	builder.environment().put("PYTHONPATH", newPythonPath);
	LOGGER.info("Running with PYTHONPATH: " + newPythonPath);
	LOGGER.info("Running with PATH: " + builder.environment().get("PATH"));
	
	// this assumes we can login with ssh without a password, or specifying
	// any options
	if (host != null && host != "127.0.0.1" ) {
		builder.command().add("ssh");
		builder.command().add(host);
		builder.command().add("cd");
		builder.command().add(runDir + ";");
		builder.command().add("PYTHONPATH=" + newPythonPath + pathSeparatorChar + "$PYTHONPATH");
	}

	File pythonMainScript = new File(opendaPythonPath, "thrift_bmi_raster_server.py");
	builder.command().add(pythonExecutable);
	builder.command().add("-u");
	
	builder.command().add(pythonMainScript.getAbsolutePath());
	builder.command().add(modelPythonModuleName);
	builder.command().add(modelPythonClassName);
	builder.command().add(host);
	builder.command().add(Integer.toString(port));

	builder.redirectError(Redirect.INHERIT);
	builder.redirectOutput(Redirect.INHERIT);

	LOGGER.info("Running command: " + Arrays.toString(builder.command().toArray()));
	return builder.start();
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:49,代码来源:BmiModelFactory.java

示例15: newEvaluator

import java.io.File; //导入方法依赖的package包/类
protected void newEvaluator() throws MalformedURLException
{
  logger.debug("creating new evaluator");
  shell = new ScalaEvaluatorGlue(newClassLoader(),
    loader_cp + File.pathSeparatorChar + System.getProperty("java.class.path"), outDir);

  if (!imports.isEmpty()) {
    for (int i = 0; i < imports.size(); i++) {
      String imp = imports.get(i).trim();
      if (imp.startsWith("import"))
        imp = imp.substring(6).trim();
      if (imp.endsWith(".*"))
        imp = imp.substring(0,imp.length()-1) + "_";
      if(!imp.isEmpty()) {
        logger.debug("importing : {}", imp);
        if(!shell.addImport(imp))
          logger.warn("ERROR: cannot add import '{}'", imp);
      }
    }
  }

  logger.debug("creating beaker object");

  // ensure object is created
  NamespaceClient.getBeaker(sessionId);

  String r = shell.evaluate2(
      "import com.twosigma.beaker.NamespaceClient\n"+
      "import language.dynamics\n"+
      "var _beaker = NamespaceClient.getBeaker(\""+sessionId+"\")\n"+
      "object beaker extends Dynamic {\n"+
      "  def selectDynamic( field : String ) = _beaker.get(field)\n"+
      "  def updateDynamic (field : String)(value : Any) : Any = {\n"+
      "    _beaker.set(field,value)\n"+
      "    return value\n"+
      "  }\n"+
      "  def applyDynamic(methodName: String)(args: AnyRef*) = {\n"+
      "    def argtypes = args.map(_.getClass)\n"+
      "    def method = _beaker.getClass.getMethod(methodName, argtypes: _*)\n"+
      "    method.invoke(_beaker,args: _*)\n"+
      "  }\n"+
      "}\n" 
      );
  if(r!=null && !r.isEmpty()) {
    logger.warn("ERROR creating beaker object: {}", r);
  }
}
 
开发者ID:twosigma,项目名称:beaker-notebook-archive,代码行数:48,代码来源:ScalaEvaluator.java


注:本文中的java.io.File.pathSeparatorChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。