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


Java Paths.get方法代码示例

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


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

示例1: saveOneWithMultipartFile

import java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void saveOneWithMultipartFile() {
    Picture picture = pictures.getFirst();

    byte[] file = new byte[1];
    file[0] = ' ';
    MultipartFile multipartFile = new MockMultipartFile(picture.getName(), file);

    service.save(picture, multipartFile);

    assertTrue(picture.equals(service.findOne(picture.getId())));
    Path f = Paths.get(picture.getPath() + picture.getName() + picture.getFileType());
    if (Files.exists(f))
        service.delete(picture);
    else
        fail("the picture wasn't created");
}
 
开发者ID:xSzymo,项目名称:Spring-web-shop-project,代码行数:18,代码来源:PicturesServiceTest.java

示例2: findMergePathFrom

import java.nio.file.Paths; //导入方法依赖的package包/类
private Path findMergePathFrom ( final String propertyName )
{
    try
    {
        final String uriValue = System.getProperty ( propertyName );
        if ( uriValue == null )
        {
            return null;
        }
        final Path path = Paths.get ( URI.create ( uriValue ) );
        if ( path == null )
        {
            return null;
        }
        return path;
    }
    catch ( final Exception e )
    {
        logger.warn ( String.format ( "Failed to find merge URI from '%s'", propertyName ), e );
        return null;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:23,代码来源:Activator.java

示例3: should_clone_repo

import java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void should_clone_repo() throws Throwable {
    // when: clone only for plugin config file
    String tmpPath = folder.getRoot().getAbsolutePath();

    GitSshClient gitClient = new GitSshClient(TEST_GIT_SSH_URL, Paths.get(tmpPath));
    gitClient.clone("develop", Sets.newHashSet(".flow.yml"), null);

    final Set<String> acceptedFiles = Sets.newHashSet(".git", ".flow.yml", "README.md");

    // then:
    File[] files = gitClient.targetPath().toFile().listFiles();
    Assert.assertEquals(3, files.length);
    for (File file : files) {
        Assert.assertTrue(acceptedFiles.contains(file.getName()));
    }
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:18,代码来源:GitSshClientTest.java

示例4: setup

import java.nio.file.Paths; //导入方法依赖的package包/类
private static void setup() throws Exception {
    Path classes = Paths.get(System.getProperty("test.classes", ""));
    JarUtils.createJarFile(Paths.get("cb.jar"),
                           classes,
                           classes.resolve("Foo.class"),
                           classes.resolve("Foo$TestElement.class"));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:DeserializeButtonTest.java

示例5: initTaxonomyDefinitionOutputPath

import java.nio.file.Paths; //导入方法依赖的package包/类
private void initTaxonomyDefinitionOutputPath(final ApplicationArguments args) {
    Path pathArg = getPathArg(args, TAXONOMY_DEFINITION_OUTPUT_PATH);
    if (pathArg == null) {
        pathArg = Paths.get(MIGRATOR_TEMP_DIR_PATH.toString(), HIPPO_IMPORT_DIR_DEFAULT_NAME);
    }

    executionParameters.setTaxonomyDefinitionOutputPath(pathArg);
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:9,代码来源:ExecutionConfigurator.java

示例6: getJavaPath

import java.nio.file.Paths; //导入方法依赖的package包/类
private Path getJavaPath(Class<?> clazz) {
    final String packageDirectory = clazz.getPackage().getName().replace(".", "/");
    final Path path = Paths.get("src/test/java", packageDirectory, clazz.getSimpleName() + ".java");

    return path.toAbsolutePath();
}
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:7,代码来源:AffectedTestsDetectorTest.java

示例7: testSetHistory

import java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void testSetHistory() throws IOException {

    int LOG_HISTORY = 22;
    Path CFG_PATHS = Paths.get("");

    builder.setCfgPaths(CFG_PATHS);

    String content = builder
        .addLocLocation()
        .setHistory(LOG_HISTORY)
        .getContent();

    builder.clearAll();
    builder.readCfgFile(content);

    assertTrue(builder.getHistory().compareTo(String.valueOf(LOG_HISTORY)) == 0);

}
 
开发者ID:ripreal,项目名称:V8LogScanner,代码行数:20,代码来源:TestLogBuilder.java

示例8: initHippoImportDir

import java.nio.file.Paths; //导入方法依赖的package包/类
private void initHippoImportDir(final ApplicationArguments args) {
    Path pathArg = getPathArg(args, HIPPO_IMPORT_DIR);
    if (pathArg == null) {
        pathArg = Paths.get(MIGRATOR_TEMP_DIR_PATH.toString(), HIPPO_IMPORT_DIR_DEFAULT_NAME);
    }

    executionParameters.setHippoImportDir(pathArg);
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:9,代码来源:ExecutionConfigurator.java

示例9: deleteFolder

import java.nio.file.Paths; //导入方法依赖的package包/类
private void deleteFolder(String tinyPounderDiskPersistenceLocation) throws IOException {
  Path rootPath = Paths.get(tinyPounderDiskPersistenceLocation);
  Files.walk(rootPath, FileVisitOption.FOLLOW_LINKS)
      .sorted(Comparator.reverseOrder())
      .map(Path::toFile)
      .forEach(File::delete);
}
 
开发者ID:Terracotta-OSS,项目名称:tinypounder,代码行数:8,代码来源:CacheManagerBusinessReflectionImpl.java

示例10: getCustomerAttr

import java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void getCustomerAttr() throws IOException {

    Path target = Paths.get("/Users/fathead/temp/file4");
    UserDefinedFileAttributeView view2 = Files.getFileAttributeView(target, UserDefinedFileAttributeView.class);
    ByteBuffer buf = ByteBuffer.allocate(view2.size(name));
    view2.read(name, buf);
    buf.flip();
    String value = Charset.defaultCharset().decode(buf).toString();
    System.out.println("value=" + value);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:12,代码来源:DoTestRuleFilterFactory.java

示例11: loadAsResource

import java.nio.file.Paths; //导入方法依赖的package包/类
public Resource loadAsResource(String path) {
    Path filePath = Paths.get(properties.getUploadFileRootPath(), path);
    Resource resource = new FileSystemResource(filePath.toFile());
    if (resource.exists() || resource.isReadable()) {
        return resource;
    }
    else {
        throw new StorageException("Could not read file: " + path);
    }
}
 
开发者ID:spring-sprout,项目名称:osoon,代码行数:11,代码来源:UserFileService.java

示例12: testCreateError

import java.nio.file.Paths; //导入方法依赖的package包/类
@Test
public void testCreateError() throws IOException {
  when(langDetection.language(any(InputFile.class))).thenReturn("java");
  ClientInputFile file = new TestClientInputFile(Paths.get("INVALID"), true, StandardCharsets.ISO_8859_1);

  InputFileBuilder builder = new InputFileBuilder(langDetection, metadata);

  exception.expect(IllegalStateException.class);
  exception.expectMessage("Failed to open a stream on file");
  builder.create(file);
}
 
开发者ID:instalint-org,项目名称:instalint,代码行数:12,代码来源:InputFileBuilderTest.java

示例13: isSupplementaryCharactersSupported

import java.nio.file.Paths; //导入方法依赖的package包/类
private static boolean isSupplementaryCharactersSupported() {
    try {
        String s = "p--\ud801\udc00--";
        System.err.println("Trying: Paths.get(" + s + ")");
        Path p1 = Paths.get(s);
        System.err.println("Found: " + p1);
        System.err.println("Trying: p1.resolve(" + s + ")");
        Path p2 = p1.resolve(s);
        System.err.println("Found: " + p2);
        return p1.toString().equals(s) && p2.toString().equals(s + java.io.File.separator + s);
    } catch (InvalidPathException e) {
        System.err.println(e);
        return false;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:Wrapper.java

示例14: createStoreManager

import java.nio.file.Paths; //导入方法依赖的package包/类
private StoreManager createStoreManager(StoreTest storeTest, String storeName) throws Exception {
    JacksonSerializer jacksonSerializer = new JacksonSerializer();
    FileStoreFactory fileStoreFactory = new FileStoreFactory(Paths.get("iron_tests-" + EXECUTION_ID));
    StoreManagerFactoryBuilder builder = StoreManagerFactoryBuilder.newStoreManagerBuilderFactory() //
            .withSnapshotSerializer(jacksonSerializer) //
            .withTransactionSerializer(jacksonSerializer) //
            .withSnapshotStoreFactory(fileStoreFactory) //
            .withTransactionStoreFactory(fileStoreFactory);
    storeTest.configure(builder);
    return builder.build().openStore(storeName);
}
 
开发者ID:Axway,项目名称:iron,代码行数:12,代码来源:AbstractStoreTests.java

示例15: main

import java.nio.file.Paths; //导入方法依赖的package包/类
public static strictfp void main(String args[]) throws Exception {
    ToolBox tb = new ToolBox();
    Path classPath = Paths.get(ToolBox.testClasses, "AnnotatedExtendsTest$Inner.class");
    String javapOut = new JavapTask(tb)
            .options("-v", "-p")
            .classes(classPath.toString())
            .run()
            .getOutput(Task.OutputKind.DIRECT);
    if (!javapOut.contains("0: #21(): CLASS_EXTENDS, type_index=65535"))
        throw new AssertionError("Expected output missing: " + javapOut);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:AnnotatedExtendsTest.java


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