Package java.io

Examples of java.io.File.createNewFile()


    if(file.exists()) {
      return -1;
    }
    else {
      try {
        file.createNewFile();
      } catch (IOException e) {
        e.printStackTrace();
        return -1;
      }
      ID--;
View Full Code Here


    File source = new File(filePosition + File.separator + sourcePath);
    if(source.isFile()){
      File target = new File(filePosition + File.separator + targetPath + File.separator + source.getName());
      if(!target.exists())
        try {
          target.createNewFile();
        } catch (IOException e) {
          e.printStackTrace();
        }
      this.fileCopy(filePosition + File.separator + sourcePath,
          filePosition + File.separator + targetPath + File.separator + target.getName());
View Full Code Here

            }

            // Datei pruefen
            if (_fileName != null && !_fileName.equals("")) {
                File file = new File(_fileName);
                file.createNewFile();
                if (!file.canWrite()) { throw new FileNotFoundException(
                        "File not writeable: " + _fileName); }

                if (_log != null) _log.debug2("Starte Export in die Datei...");
View Full Code Here

      file = new File(targetPath + "META-INF");
      if ( !file.isDirectory() )
        file.mkdir();
     
      file = new File(targetPath + "META-INF/MANIFEST.MF");
      file.createNewFile();
     
      StringBuffer sbuf = new StringBuffer();
      sbuf.append("Manifest-Version: 1.0\n");
      sbuf.append("Created-By: "+System.getProperty("java.vm.version")+" ("+System.getProperty("java.vm.vendor")+")\n");
      sbuf.append("\n");
View Full Code Here

      file = new File(this.targetPath);
     
      if ( file.isFile() )
        file.delete();
     
      file.createNewFile();
     
    } catch (IOException iox) {
     
      if ( file != null )
        throw new Exception(iox.getMessage()+": "+file.getCanonicalPath());
View Full Code Here

        File tempDir = (File) getServletContext().getAttribute
            ("javax.servlet.context.tempdir");
        // Convert all '/' characters to '.' in resourcePath
        String convertedResourcePath = path.replace('/', '.');
        File contentFile = new File(tempDir, convertedResourcePath);
        if (contentFile.createNewFile()) {
            // Clean up contentFile when Tomcat is terminated
            contentFile.deleteOnExit();
        }

        RandomAccessFile randAccessContentFile =
View Full Code Here

      if (!parent.exists()) createManagedDir(parent);
      getLog().debug3("creating managed folder "+managedDir.getAbsolutePath());
      if(!managedDir.mkdir()) throw new Exception("mkdir failed");
      File managedIndicator = new File(managedDir, ".managed");
      getLog().debug5("Creating file "+managedIndicator.getAbsolutePath());
      if(!managedIndicator.createNewFile()){
        throw new Exception("Failed to create file "+managedIndicator.getAbsolutePath());
      }
    } catch(Exception e){
      throw new Exception("Error creating managed folder "+managedDir.getAbsolutePath()+": "+e,e);
    }   
View Full Code Here

                  FileUtils.createEmptyFile(new File(filePath));
                } else {
                  // create file with content               
                  try {
                    File testFile = new File(filePath);
                    testFile.createNewFile();
                    FileOutputStream fos = new FileOutputStream(testFile);
                    for (int i=0; i<nbrCharInFile;i=i+15) {
                      fos.write("testfilesystem\n".getBytes());
                    }
                    if (fileSystemTestForm.isFsSyncEnabled()) {
View Full Code Here

      getImageFilename(src));
    File targetFile = new File(new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome()),
      getImageFilename(target));
    if (srcFile.exists()) {
      try {
        targetFile.createNewFile();
        FileUtils.copy(new BufferedInputStream(new FileInputStream(srcFile)), new BufferedOutputStream(new FileOutputStream(targetFile)));
      } catch (IOException ioe) {
        return false;
      }
    }
View Full Code Here

      try {
        final File fleF = new File(pstrFileName);
        if (fleF.exists()) {
        }
        else {
          fleF.createNewFile();
        }
        if (fleF.canWrite()) {
          // nothing to do
        }
        else {
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.