Package java.io

Examples of java.io.File.createNewFile()


     * In case there is no database file, we just set the version as the current
     * version.
     */
    if (!formatFileExists) {
      try {
        formatFile.createNewFile();
      } catch (IOException ioe) {
        throw new PersistenceException("Error creating database", ioe); //$NON-NLS-1$
      }
    }
    setFormatVersion(formatFile);
View Full Code Here


  protected void pageOut(JRVirtualizable o) throws IOException {
    // Store data to a file.
    String filename = makeFilename(o);
    File file = new File(directory, filename);
   
    if (file.createNewFile()) {
      if (JRProperties.getBooleanProperty(PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT)) {
        file.deleteOnExit();
      }

      FileOutputStream fos = null;
View Full Code Here

            {              
               if (log.isTraceEnabled())
               {
                  log.trace("Creating file " + file);
               }
               file.createNewFile();
               file.deleteOnExit();
              
               writer = new PrintWriter(file);
               writer.println(bootstrapUrl);
               writer.flush();
View Full Code Here

    if (writeFile.exists()) {
      // remove exising files first
      writeFile.delete();
    }
    try {
      writeFile.createNewFile();
    } catch (IOException e) {
      log.warn("No UTF-8 capable filesystem found! Error while writing testfile to filesystem", e);
    }
    // try to lookup file: get files from filesystem and search for file we created above
    File[] tmpFiles = tmpDir.listFiles();
View Full Code Here

   * @see org.olat.core.util.vfs.VFSContainer#createChildLeaf(java.lang.String)
   */
  public VFSLeaf createChildLeaf(String name) {
    File fNewFile = new File(getBasefile(), name);
    try {
      if (!fNewFile.createNewFile()) {
        log.warn("Could not create a new leaf::" + name + " in container::" + getBasefile().getAbsolutePath() + " - file alreay exists");
        return null;
      }
    } catch (Exception e) {
      log.error("Error while creating child leaf::" + name + " in container::" + getBasefile().getAbsolutePath(), e);
View Full Code Here

                    }

                    if (!dirlist.contains(blacklistToUse)) {
                        try {
                            final File newFile = new File(ListManager.listsPath, blacklistToUse);
                            newFile.createNewFile();

                            // share the newly created blacklist
                            ListManager.updateListSet(BLACKLIST_SHARED, blacklistToUse);

                            // activate it for all known blacklist types
View Full Code Here

    }

   
    public IFileInfo newFile(String id, String mimeType, int cacheExpireTime) throws IOException {
      File file = new File(fileBasepath + File.separator + id + "." + encode(mimeType) + "." + encode(Integer.toString(cacheExpireTime)));
      file.createNewFile();

      return new FileInfo(file, mimeType, id, file.lastModified(), cacheExpireTime);
    }

   
View Full Code Here

        }
        else {
            result = new File(containingFolder, filename+suffix);
        }
        if (!result.exists()) {
            result.createNewFile();
        }
        return result;
       
    }
   
View Full Code Here

        }
        TrackEnumerator te = new TrackEnumerator();
        te.getSettings().setSaveRun(true);
        te.getSettings().setFiles(new File[] {parent.copyDir});
        File cantwork = new File(parent.copyDir, "CantWork.ogg");
        assertTrue(cantwork.createNewFile());
        int processed = te.process(false);
        assertTrue(processed < 0);
        for (int i = 0; i < files.length; i++) {
            AudioFile file = AudioFileIO.read(files[i]);
            assertTrue("Tag written despite errornous file.", file.getTag()
View Full Code Here

    }

    private static File getDisabledExtensionFile() throws IOException {
        File confDirectory = ContextHolder.getContext().getConfDirectory();
        File file = new File(confDirectory, DISABLED_EXTENSIONS_FILE);
        if(!file.exists() && !file.createNewFile())
            throw new IOException("Failed to create disabled extensions file");
        return file;
    }

    private static void storeProperties(Properties properties) throws IOException {
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.