Package java.io

Examples of java.io.File.mkdirs()


      File[] files = file.listFiles();
      File _target = new File(target.getPath()
          + (isRoot ? "" : (File.separator + file.getName())));

      if (!_target.exists())
        _target.mkdirs();

      for (File f : files) {
        this.generateFile(_target, f, false, entityName);
      }
    } else {
View Full Code Here


  }

  private void checkDirExist(String parentPath) {
    File dir = new File(parentPath);
    if (!dir.exists())
      dir.mkdirs();
  }

  private void initVelocity() {
    Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH,
        this.templatePath);
View Full Code Here

      packageName = "org.cnoss.rs";
    System.out.println(packageName);

    File targetPathFile = new File(targetPath);
    if (!targetPathFile.exists())
      targetPathFile.mkdirs();

    CodeGenerator generator = new CodeGenerator();
    if (codeGenerateType.equals("1")) {
      generator.createSimpleProject(targetPath, projectName, packageName);
    } else if (codeGenerateType.equals("2")) {
View Full Code Here

    }

    protected File saveEntry(InputStream is, ZipEntry entry) throws Exception {
        File file = new File(destDir, entry.getName());
        if (entry.isDirectory()) {
            file.mkdirs();
        } else {
            File dir = new File(file.getParent());
            dir.mkdirs();
            FileOutputStream fos = new FileOutputStream(file);
            pump(is, fos);
View Full Code Here

        File file = new File(destDir, entry.getName());
        if (entry.isDirectory()) {
            file.mkdirs();
        } else {
            File dir = new File(file.getParent());
            dir.mkdirs();
            FileOutputStream fos = new FileOutputStream(file);
            pump(is, fos);
            fos.flush();
            fos.close();
        }
View Full Code Here

    }

    public static void copyFile(InputStream srcStream, File destFile, boolean overwrite) throws IOException {
        File parentFile = destFile.getParentFile();
        if (!parentFile.isDirectory())
            parentFile.mkdirs();
        if (destFile.exists()) {
            if (overwrite) {
                log.debug("Overwriting file at: " + destFile.getAbsolutePath());
                writeStreamToFile(srcStream, destFile);
            } else {
View Full Code Here

        modules.clear();
       
        if (!isLoggedIn()) return;
       
        File dir = new File(DataCrow.webDir, "/images/modules/");
        dir.mkdirs();
        String[] files = dir.list();
        if (files != null) {
            for (String file : files)
                new File(DataCrow.webDir, "/images/modules/" + file).delete();
        }
View Full Code Here

    }

    @Test
    public void testExecuteWithExistingWrapperJarParentDirAndExistingWrapperJar() throws IOException {
        File jarDir = new File(getProject().getProjectDir(), "lib");
        jarDir.mkdirs();
        File wrapperJar = new File(getProject().getProjectDir(), targetWrapperJarPath);
        File parentFile = expectedTargetWrapperJar.getParentFile();
        assertTrue(parentFile.isDirectory() || parentFile.mkdirs());
        try {
            assertTrue(expectedTargetWrapperJar.createNewFile());
View Full Code Here

    public void testExecuteWithExistingWrapperJarParentDirAndExistingWrapperJar() throws IOException {
        File jarDir = new File(getProject().getProjectDir(), "lib");
        jarDir.mkdirs();
        File wrapperJar = new File(getProject().getProjectDir(), targetWrapperJarPath);
        File parentFile = expectedTargetWrapperJar.getParentFile();
        assertTrue(parentFile.isDirectory() || parentFile.mkdirs());
        try {
            assertTrue(expectedTargetWrapperJar.createNewFile());
        } catch (IOException e) {
            throw new RuntimeException(String.format("Could not create %s.", wrapperJar), e);
        }
View Full Code Here

        TestUtil.assertArraysEqual(expected, baos.toByteArray());
    }

    public void testRetrieveWithPath() throws Exception {
        File dir = new File(ROOT_DIR, "foo/bar");
        dir.mkdirs();

        File testFile = new File(dir, TEST_FILENAME);

        TestUtil.writeDataToFile(testFile, testData);
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.