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


Java File.separatorChar方法代码示例

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


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

示例1: listClassesAndAnalyzeSubDirectories

import java.io.File; //导入方法依赖的package包/类
private Set<String> listClassesAndAnalyzeSubDirectories(String dir, String packageName)
		throws IOException, XMLStreamException {
	final Set<String> classNameList = new LinkedHashSet<>();
	final String directory;
	if (packageName == null) {
		directory = dir;
	} else {
		directory = dir + File.separatorChar + packageName.replace('.', File.separatorChar);
	}
	for (final File file : DcdHelper.listFiles(new File(directory))) {
		if (isInterrupted()) {
			break;
		}
		final String fileName = file.getName();
		final String name = packageName != null ? packageName + '.' + fileName : fileName;
		if (file.isDirectory() && fileName.indexOf('.') == -1) {
			analyzeDirectory(dir, name);
		} else if (fileName.endsWith(".class")) {
			classNameList.add(name.substring(0, name.length() - ".class".length()));
		}
	}
	return classNameList;
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:24,代码来源:DeadCodeDetector.java

示例2: main

import java.io.File; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        if (File.separatorChar == '\\' ||                // Windows
                                !new File(TEE).exists()) // no tee
            return;

        Process p = Runtime.getRuntime().exec(TEE);
        OutputStream out = p.getOutputStream();
        InputStream in = p.getInputStream();
        Thread t1 = new WriterThread(out, in);
        t1.start();
        Thread t2 = new WriterThread(out, in);
        t2.start();
        t1.join();
        t2.join();
        if (savedException != null)
            throw savedException;
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:ConcurrentRead.java

示例3: getFirstIllegalCharacter

import java.io.File; //导入方法依赖的package包/类
/**
 * Returns the code point of the first illegal character in the given database
 * name.
 *
 * @return the code point of the first illegal character or -1 if all characters
 *         are valid.
 *
 * @throws NullPointerException if <code>databaseName</code> is null.
 */
public  int getFirstIllegalCharacter(String databaseName) {
    if (databaseName == null) {
        throw new NullPointerException("The databaseName parameter cannot be null"); // NOI18N
    }

    for (int i = 0; i < databaseName.length(); i++) {
        char ch = databaseName.charAt(i);
        if (ch == '/') {
            return (int)ch;
        }
        if (ch == File.separatorChar) {
            return (int)ch;
        }
    }

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

示例4: getStandardProfileFile

import java.io.File; //导入方法依赖的package包/类
/**
 * Returns a file object corresponding to a built-in profile
 * specified by fileName.
 * If there is no built-in profile with such name, then the method
 * returns null.
 */
private static File getStandardProfileFile(String fileName) {
    String dir = System.getProperty("java.home") +
        File.separatorChar + "lib" + File.separatorChar + "cmm";
    String fullPath = dir + File.separatorChar + fileName;
    File f = new File(fullPath);
    return (f.isFile() && isChildOf(f, dir)) ? f : null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:ICC_Profile.java

示例5: getHookScriptName

import java.io.File; //导入方法依赖的package包/类
private String getHookScriptName() {
  final String scriptName = "hook."
      + (System.getProperty("os.name").toLowerCase().startsWith("win") ? "bat" : "sh");
  return "'src" + File.separatorChar + "test" + //
      File.separatorChar + "resources" + //
      File.separatorChar + "scripts" + //
      File.separatorChar + scriptName + "'";
}
 
开发者ID:SAP,项目名称:java-memory-assistant,代码行数:9,代码来源:E2eITest.java

示例6: getFileLocation

import java.io.File; //导入方法依赖的package包/类
/** determines using path for marshalling and unmarshalling the XML files from teh config files
 * @param userFile true if we want the user-specific file, else the default file.
 * @param userId user ID
 * @param userGridId user Grid Id
 * @return returns location string
 */
private static String getFileLocation(boolean userFile, String userId, String userGridId) {
    String root = null;
    // Get root location of setting files
    if (userFile) {
        root = (String) Config.getProperty(Config.PROP_USER_GRID_SETTINGS_URI, DEFAULT_SETTINGS_LOCATION);
    } else {
        root = (String) Config.getProperty(Config.PROP_DEFAULT_GRID_SETTINGS_URI, DEFAULT_SETTINGS_LOCATION);
    }

    // Make sure the directory seperator is always '/' as this is a url.
    if (root.startsWith("file:") && File.separatorChar != URL_CHAR) {
        root.replace(File.separatorChar, URL_CHAR);
    }

    String encodedUserId = userId;
    if(userId!=null) {
        try {
            encodedUserId = URLEncoder.encode(userId, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            log.error("UserId encoding error.", ex);
        }
    }
    // build url
    if (userFile) {
        return root + (root.endsWith(URL_STRING) ? "" : URL_STRING) + encodedUserId + URL_STRING + "UGW_" + userGridId + ".xml";
    } else {
        return root + (root.endsWith("" + URL_STRING) ? "" : URL_STRING) + "UGW_" + userGridId + ".xml";
    }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:36,代码来源:UserGridManager.java

示例7: computeTestingClassPaths

import java.io.File; //导入方法依赖的package包/类
/**
 * Gives a map from test type (e.g. <em>unit</em> or <em>qa-functional</em>)
 * to the {@link TestClasspath test classpath} according to the content in
 * the project's metadata (<em>project.xml<em>).
 */
private Map<String,TestClasspath> computeTestingClassPaths(ModuleList ml, PropertyEvaluator evaluator, Set<String> extraTestTypes) {
    Map<String, TestClasspath> classpaths = new HashMap<String,TestClasspath>();
    ProjectXMLManager pxm = new ProjectXMLManager(project);
    Map<String, Set<TestModuleDependency>> testDependencies = pxm.getTestDependencies(ml);
    
    String testDistDir =  evaluator.getProperty("test.dist.dir"); // NOI18N
    if (testDistDir == null) {
        NbModuleType type = project.getModuleType();
        if (type == NbModuleType.NETBEANS_ORG) {
            // test.dist.dir = ${nb_all}/nbbuild/build/testdist
            String nball = evaluator.getProperty("nb_all"); // NOI18N
            testDistDir = nball + File.separatorChar + "nbbuild" + File.separatorChar + "build" + File.separatorChar + "testdist"; // NOI18N
        } else if ( type == NbModuleType.SUITE_COMPONENT) {
            // test.dist.dir = ${suite.build.dir}/testdist
            String suiteDir = evaluator.getProperty("suite.build.dir"); // NOI18N
            testDistDir = suiteDir + File.separatorChar + "testdist"; // NOI18N
        } else {
            // standalone module
            // test.dist.dir = ${build.dir}/testdist
            String moduleDir = evaluator.getProperty("build.dir"); // NOI18N
            testDistDir = moduleDir + File.separatorChar + "testdist"; // NOI18N
        }
    }
    for (Map.Entry<String,Set<TestModuleDependency>> entry : testDependencies.entrySet()) {
        computeTestType(entry.getKey(), new File(testDistDir), entry.getValue(), classpaths, ml);
    }
    for (String testType : extraTestTypes) {
        if (!testDependencies.containsKey(testType)) {
            // No declared dependencies of this type, so will definitely need to add in compatibility libraries.
            computeTestType(testType, new File(testDistDir), Collections.<TestModuleDependency>emptySet(), classpaths, ml);
        }
    }
    return classpaths;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:Evaluator.java

示例8: initAppenders

import java.io.File; //导入方法依赖的package包/类
private static void initAppenders() throws IOException {
    systemLogAppender = new RollingFileAppender(getLayout(), logFilePath
            + File.separatorChar + "system.log");
    accessLogAppender = new RollingFileAppender(getLayout(), logFilePath
            + File.separatorChar + "access.log");
    auditLogAppender = new RollingFileAppender(getLayout(), logFilePath
            + File.separatorChar + "audit.log");
    reverseProxyLogAppender = new RollingFileAppender(getLayout(),
            logFilePath + File.separatorChar + "reverseproxy.log");

    // setting the max backup index and file size
    systemLogAppender.setMaxBackupIndex(MAX_BACKUP_INDEX);
    systemLogAppender.setMaxFileSize(MAX_FILE_SIZE);
    systemLogAppender.setName(systemLogAppenderName);

    accessLogAppender.setMaxBackupIndex(MAX_BACKUP_INDEX);
    accessLogAppender.setMaxFileSize(MAX_FILE_SIZE);
    accessLogAppender.setName(accessLogAppenderName);

    auditLogAppender.setMaxBackupIndex(MAX_BACKUP_INDEX);
    auditLogAppender.setMaxFileSize(MAX_FILE_SIZE);
    auditLogAppender.setName(auditLogAppenderName);

    reverseProxyLogAppender.setMaxBackupIndex(MAX_BACKUP_INDEX);
    reverseProxyLogAppender.setMaxFileSize(MAX_FILE_SIZE);
    reverseProxyLogAppender.setName(reverseProxyLogAppenderName);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:28,代码来源:LoggerFactory.java

示例9: getClassList

import java.io.File; //导入方法依赖的package包/类
/**
 * Walk through CLASSPATH and find class list from a package.
 * The class names start with prefix string
 * @param package name, class name prefix
 * @return class list in an array of String
 */
private static String[] getClassList(String pkgName, String prefix) {
    Vector listBuffer = new Vector();
    String packagePath = pkgName.replace('.', File.separatorChar)
        + File.separatorChar;
    String zipPackagePath = pkgName.replace('.', ZIPSEPARATOR)
        + ZIPSEPARATOR;
    for (int i = 0; i < classPathSegments.size(); i++){
        String onePath = (String) classPathSegments.elementAt(i);
        File f = new File(onePath);
        if (!f.exists())
            continue;
        if (f.isFile())
            scanFile(f, zipPackagePath, listBuffer, prefix);
        else if (f.isDirectory()) {
            String fullPath;
            if (onePath.endsWith(File.separator))
                fullPath = onePath + packagePath;
            else
                fullPath = onePath + File.separatorChar + packagePath;
            File dir = new File(fullPath);
            if (dir.exists() && dir.isDirectory())
                scanDir(dir, listBuffer, prefix);
        }
    }
    String[] classNames = new String[listBuffer.size()];
    listBuffer.copyInto(classNames);
    return classNames;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:NIOCharsetAvailabilityTest.java

示例10: getFileSystemView

import java.io.File; //导入方法依赖的package包/类
public static FileSystemView getFileSystemView() {
    if(File.separatorChar == '\\') {
        if(windowsFileSystemView == null) {
            windowsFileSystemView = new WindowsFileSystemView();
        }
        return windowsFileSystemView;
    }

    if(File.separatorChar == '/') {
        if(unixFileSystemView == null) {
            unixFileSystemView = new UnixFileSystemView();
        }
        return unixFileSystemView;
    }

    // if(File.separatorChar == ':') {
    //    if(macFileSystemView == null) {
    //      macFileSystemView = new MacFileSystemView();
    //    }
    //    return macFileSystemView;
    //}

    if(genericFileSystemView == null) {
        genericFileSystemView = new GenericFileSystemView();
    }
    return genericFileSystemView;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:FileSystemView.java

示例11: slashCount

import java.io.File; //导入方法依赖的package包/类
/**
 * counts the amount of '/' in a String
 */
private static int slashCount(String path) {
    if (path == null) return 0;
    int ret = 0;
    for (int i = 0; i < path.length(); i++) {
        if (path.charAt(i) == File.separatorChar) {
            ret ++;
        }
    }
    return ret;
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:14,代码来源:VobHandler.java

示例12: SystemConfig

import java.io.File; //导入方法依赖的package包/类
public SystemConfig() {
    this.serverPort = DEFAULT_PORT;
    this.managerPort = DEFAULT_MANAGER_PORT;
    this.serverBacklog = DEFAULT_BACK_LOG_SIZE;
    this.charset = DEFAULT_CHARSET;
    this.processors = DEFAULT_PROCESSORS;
    this.bufferPoolPageSize = DEFAULT_BUFFER_POOL_PAGE_SIZE;
    this.bufferPoolChunkSize = DEFAULT_BUFFER_CHUNK_SIZE;
    // if always big result,need large network buffer pool pages.
    this.bufferPoolPageNumber = (short) (DEFAULT_PROCESSORS * 20);

    this.processorExecutor = (DEFAULT_PROCESSORS != 1) ? DEFAULT_PROCESSORS * 2 : 4;

    this.idleTimeout = DEFAULT_IDLE_TIMEOUT;
    this.processorCheckPeriod = DEFAULT_PROCESSOR_CHECK_PERIOD;
    this.xaSessionCheckPeriod = DEFAULT_XA_SESSION_CHECK_PERIOD;
    this.xaLogCleanPeriod = DEFAULT_XA_LOG_CLEAN_PERIOD;
    this.dataNodeIdleCheckPeriod = DEFAULT_DATA_NODE_IDLE_CHECK_PERIOD;
    this.dataNodeHeartbeatPeriod = DEFAULT_DATA_NODE_HEARTBEAT_PERIOD;
    this.clusterHeartbeatUser = DEFAULT_CLUSTER_HEARTBEAT_USER;
    this.clusterHeartbeatPass = DEFAULT_CLUSTER_HEARTBEAT_PASS;
    this.txIsolation = Isolations.REPEATABLE_READ;
    this.sqlRecordCount = DEFAULT_SQL_RECORD_COUNT;
    this.glableTableCheckPeriod = DEFAULT_GLOBAL_TABLE_CHECK_PERIOD;
    this.xaRecoveryLogBaseDir = SystemConfig.getHomePath() + "/tmlogs/";
    this.xaRecoveryLogBaseName = "tmlog";
    this.viewPersistenceConfBaseDir = SystemConfig.getHomePath() + "/viewConf/";
    this.viewPersistenceConfBaseName = "viewJson";
    this.transactionLogBaseDir = SystemConfig.getHomePath() + File.separatorChar + DEFAULT_TRANSACTION_BASE_DIR;
    this.transactionLogBaseName = DEFAULT_TRANSACTION_BASE_NAME;
    this.transactionRatateSize = DEFAULT_TRANSACTION_ROTATE_SIZE;
    this.mergeQueueSize = DEFAULT_MERGE_QUEUE_SIZE;
    this.orderByQueueSize = DEFAULT_ORDER_BY_QUEUE_SIZE;
    this.joinQueueSize = DEFAULT_JOIN_QUEUE_SIZE;
    this.nestLoopRowsSize = DEFAULT_NEST_LOOP_ROWS_SIZE;
    this.nestLoopConnSize = DEFAULT_NEST_LOOP_CONN_SIZE;
    this.mappedFileSize = DEFAULT_MAPPED_FILE_SIZE;
    this.useJoinStrategy = DEFAULT_USE_JOIN_STRATEGY;
}
 
开发者ID:actiontech,项目名称:dble,代码行数:40,代码来源:SystemConfig.java

示例13: getWorkDirPathFromManager

import java.io.File; //导入方法依赖的package包/类
private static String getWorkDirPathFromManager() {
    String path = System.getProperty(NBJUNIT_WORKDIR);
            
    if (path == null) {            
        // try to get property from user's settings
        path = readProperties().getProperty(NBJUNIT_WORKDIR);
    }
    if (path != null) {
        path = path.replace('/', File.separatorChar);
    } else {
        // Fallback value, guaranteed to be defined.
        path = System.getProperty("java.io.tmpdir") + File.separatorChar + "tests-" + System.getProperty("user.name");
    }
    return path;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:HintTest.java

示例14: getNewConfigFile

import java.io.File; //导入方法依赖的package包/类
private static File getNewConfigFile() {
    String configPath = System.getenv("DOCKER_CONFIG");
    if (configPath == null) {
        configPath = System.getProperty("user.home") + File.separatorChar + ".docker";
    }

    return new File(configPath, "config.json");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DockerConfig.java

示例15: 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


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