Package java.nio.file

Examples of java.nio.file.Path.toFile()


        FileUtils.deleteDirectory(dataDir);
    }

    protected Catalog createCatalog() throws IOException {
        Path dataDir = Files.createTempDirectory(Paths.get("target"), "data");
        GeoServerResourceLoader resourceLoader = new GeoServerResourceLoader(dataDir.toFile());

        Catalog cat = new CatalogImpl();
        cat.setResourceLoader(resourceLoader);
        cat.addListener(new GeoServerPersister(resourceLoader, new XStreamPersisterFactory().createXMLPersister()));
        return cat;
View Full Code Here


        Path zip = exporter.zip();

        response.setContentType(APPLICATION_ZIP_VALUE);
        response.setHeader("Content-Disposition", "attachment; filename=\""+zip.getFileName()+"\"");
        FileUtils.copyFile(zip.toFile(), response.getOutputStream());
    }


    @RequestMapping(value = "/{wsName}/import", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public void inport(@PathVariable String wsName, HttpServletRequest request, HttpServletResponse response)
View Full Code Here

        }

        FileItem file = files.next();

        Path zip = Files.createTempFile(null, null);
        file.write(zip.toFile());

        BundleImporter importer = new BundleImporter(cat, new ImportOpts(ws));
        importer.unzip(zip);
        importer.run();
View Full Code Here

        try {
            // Check if we have a valid template path
            String template = domain.getTemplate();
            if (template != null && !template.isEmpty()) {
                Path templatePath = Paths.get(template);
                File templateFile = templatePath.toFile();
                if (!templateFile.isDirectory()) {
                    // Not a file
                    logger.log(Level.SEVERE, "Template directory ''{0}'' is not a directory!", templatePath);
                    result.setResult("Invalid Template directory");
                } else {
View Full Code Here

        // Get stats
        Iterator<Path> dataFiles = Files.newDirectoryStream(streamDirectory, "out-*").iterator();
        Path lastPath = dataFiles.next();
        long nextBlockPosition = 0;
        RandomAccessFile input = new RandomAccessFile(lastPath.toFile(), "r");
        while (true) {
            if (nextBlockPosition != 0) {
                input.seek(nextBlockPosition);
            }
            if (input.getFilePointer() >= input.length()) {
View Full Code Here

                if (!dataFiles.hasNext()) {
                    log.info("ran out of mux data files after : " + lastPath.toString());
                    break;
                }
                lastPath = dataFiles.next();
                input = new RandomAccessFile(lastPath.toFile(), "r");
                nextBlockPosition = 0;
            }
            // parse the next block
            int countIDs = input.readShort();
            chunks += countIDs;
View Full Code Here

        ImportFile importer = new ImportFile();
       
        if (importer.checkExtension(fullPath.toString())) {
          importer.setDir(fullPath.toString());
          DomainResults result = importer.importFile();
          result.saveResult(fullPath.toFile().getName().toString().replace(".dat", ""), dirOut);
        }
      }
      boolean valid = key.reset();
      if (!valid) {
        break;
View Full Code Here

                    for (WatchEvent<?> watchEvent : watchKey.pollEvents()) {
                        WatchEvent.Kind<?> kind = watchEvent.kind();

                        Path eventPath = ((WatchEvent<Path>)watchEvent).context();
                        Path resolvedPath = ((Path)watchKey.watchable()).resolve(eventPath);
                        File resolvedFile = resolvedPath.toFile();

                        if (connector.isExcluded(resolvedFile)) {
                            continue;
                        }
View Full Code Here

    Path tmp = getTemporaryDirectory();
    if (tmp == null) {
      tmp = createDirInsideApplication();
    }
   
    return tmp.toFile();
  }

  protected Path getTemporaryDirectory() {
    try {
      Path tmp = Files.createTempFile("vraptor", "upload");
View Full Code Here

        }
    }

    public void testComponentDirIsFile() throws Exception {
        Path path = Files.createTempFile("badOutput", "foo");
        RegistrySerializer rs = new RegistrySerializer(path.toFile(), actb.getComponentsPath().toFile(), null, null);
        try {
            rs.execute();
        } catch (RegistrySerializerException mee) {
            assertTrue("Expected error about component directory: "+mee.getMessage(),
                    mee.getMessage().startsWith("Component directory is not a directory:"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.