Package java.io

Examples of java.io.File.createNewFile()


      try {
         file = new File(this.pollerDirName);
         boolean ret = file.mkdir();
         assertTrue("could not create directory '" + this.pollerDirName + "'", ret);
         file = new File(this.pollerDirNameSent);
         file.createNewFile();
      }
      catch (IOException ex) {
         assertTrue("could not create the file '" + this.pollerDirNameSent + "'", false);
      }
     
View Full Code Here


      try {
         File lock = null;
         if (lockExt != null) {
            String tmp = filename + lockExt.substring(1);
            lock = new File(tmp);
            boolean ret = lock.createNewFile();
            assertTrue("could not create lock file '" + tmp + "'", ret);
         }
         byte[] buf = new byte[size];
         for (int i=0; i < size; i++) {
            buf[i] = (byte)i;
View Full Code Here

     
      // now some which should fail:
      // existing file but not a directory
      File file = new File(this.dirName);
      try {
         file.createNewFile();
      }
      catch (IOException ex) {
         assertTrue("could not create the file '" + this.dirName + "'", false);
      }
     
View Full Code Here

      try {
         file = new File(this.dirName);
         boolean ret = file.mkdir();
         assertTrue("could not create directory '" + this.dirName + "'", ret);
         file = new File(this.dirNameSent);
         file.createNewFile();
      }
      catch (IOException ex) {
         assertTrue("could not create the file '" + this.dirNameSent + "'", false);
      }
     
View Full Code Here

      try {
         File lock = null;
         if (lockExt != null) {
            String tmp = filename + lockExt.substring(1);
            lock = new File(tmp);
            boolean ret = lock.createNewFile();
            assertTrue("could not create lock file '" + tmp + "'", ret);
            int upd = this.updateInterceptor.waitOnUpdate(timeToWait);
            assertEquals("when writing lock file should not update", 0, upd);
         }
         else
View Full Code Here

    BoboIndexReader idxReader=dumper._reader;
    try{
      outDir.mkdirs();
      File outFile=new File(outDir,"dataout.txt");
      if (!outFile.exists()) outFile.createNewFile();
     
      writer=new FileWriter(outFile);
      BufferedWriter bwriter=new BufferedWriter(writer);
      dumper=new IndexDumper(idxDir);
      Set<String> fields=idxReader.getFacetNames();
View Full Code Here

                       newFile.getParentFile().equals( parentDir ) );

    try
    {
      Assert.assertTrue( "Failed to create new file [" + newFile.getAbsolutePath() + "].",
                         newFile.createNewFile());
    }
    catch ( IOException e )
    {
      Assert.assertTrue( "Failed to create new file <" + newFile.getAbsolutePath() + ">: " + e.getMessage(),
                         false );
View Full Code Here

  /** debug */
  static void make(DiskCache2 dc, String filename) throws IOException {
    File want = dc.getCacheFile(filename);
    System.out.println("make=" + want.getPath() + "; exists = " + want.exists());
    if (!want.exists())
      want.createNewFile();
    System.out.println(" canRead= " + want.canRead() + " canWrite = " + want.canWrite() + " lastMod = " + new Date(want.lastModified()));

    String enc = EscapeStrings.urlEncode(filename);
    System.out.println(" original=" + EscapeStrings.urlDecode(enc));
    /* try {
View Full Code Here

    // create and test write permissions
    fidx = new File(gribName + currentSuffix);
    // now comes the tricky part to make sure we can open and write to it
    try {
      if (fidx.createNewFile()) {
        fidx.delete();
        return fidx.getPath();
      }
    } catch (IOException e) {
      // cant write to it - drop through
View Full Code Here

                    if (e.getStatus() == 0) {
                        it = doneFiles.iterator();
                        while (it.hasNext()) {
                            File doneFile = (File)it.next();
                            doneFile.delete();
                            doneFile.createNewFile();
                        }
                    } else {
                        throw e;
                    }
                } finally {
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.