Package java.io

Examples of java.io.File.deleteOnExit()


        File file = null;
        if (tmpdir != null)
            file = File.createTempFile("libtiff.jai.", ".dat", new File(tmpdir));
        else
            file = File.createTempFile("libtiff.jai.", ".dat");
        file.deleteOnExit();
        return file;
    }

    private void copyImageData(File tmp, OutputStream out, int total)
            throws IOException {
View Full Code Here


  public void testChar255() throws Exception {
    File temp = File.createTempFile(TRECDocumentCollectionTest.class
        .getName(), ".testChar255");

    temp.deleteOnExit();
    OutputStream outputStream = new FileOutputStream(temp);
    IOUtils.copy(this.getClass().getResourceAsStream("testChar255.data"),
        outputStream);
    outputStream.close();
View Full Code Here

  public void testContents() throws Exception {
    File temp = File.createTempFile( TRECDocumentCollectionTest.class.getName(), ".testContents" );
    File tempAgain = File.createTempFile( TRECDocumentCollectionTest.class.getName(), ".testContentsAgain" );

    temp.deleteOnExit();
    tempAgain.deleteOnExit();
    OutputStream outputStream = new FileOutputStream( temp );
    OutputStream outputStreamAgain = new FileOutputStream( tempAgain );
    IOUtils.copy( this.getClass().getResourceAsStream( "testContents.data" ), outputStream );
    outputStream.close();
    IOUtils.copy( this.getClass().getResourceAsStream( "testContentsAgain.data" ), outputStreamAgain );
View Full Code Here

            File log = new File("derby.log");
            if (log.exists()) {
                if (now) {
                    log.delete();
                } else {
                    log.deleteOnExit();
                }
            }
            root = new File(path);
        } else {
            root = new File(dsh);
View Full Code Here

                    final File fileSystemResource = File.createTempFile(resourceFileName, null);
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("Temporary file will be deleted on VM exit: " + fileSystemResource.getAbsolutePath());
                    }
                    fileSystemResource.deleteOnExit();
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("Copying classpath resource contents into temporary file");
                    }
                    writeUrlToFile(urlResource, fileSystemResource.toString(), null);
View Full Code Here

        contents.append("hibernate.connection.url=").append(connectionUrl).append("\n");
        contents.append("hibernate.connection.username=").append(username).append("\n");
        contents.append("hibernate.connection.password=").append(password).append("\n");
        final File temporaryProperitesFile =
            new File(HIBERNATE_PROPERTIES_TEMP_DIRECTORY, new Random().nextDouble() + "");
        temporaryProperitesFile.deleteOnExit();
        ResourceWriter.instance().writeStringToFile(
            contents.toString(),
            temporaryProperitesFile.toString());
        arguments.add("--properties=" + temporaryProperitesFile);
    }
View Full Code Here

    private String resourceName;
    private ClassLoaderResolver clr;
   
    public void setUp() throws IOException {
        File resource = File.createTempFile("test", "resource");
        resource.deleteOnExit();
        resourceName = resource.getName();

        FileWriter writer = new FileWriter(resource);
        writer.write(RESOURCE_DATA);
        writer.write("\n");
View Full Code Here

        contents.append("hibernate.connection.url=" + connectionUrl + "\n");
        contents.append("hibernate.connection.username=" + username + "\n");
        contents.append("hibernate.connection.password=" + password + "\n");
        final File temporaryProperitesFile =
            new File(HIBERNATE_PROPERTIES_TEMP_DIRECTORY, new Random().nextDouble() + "");
        temporaryProperitesFile.deleteOnExit();
        ResourceWriter.instance().writeStringToFile(
            contents.toString(),
            temporaryProperitesFile.toString());
        arguments.add("--properties=" + temporaryProperitesFile);
    }
View Full Code Here

            } catch (final RuntimeException e) {
                // not a valid release
              // can be also a restart- or deploy-file
                final File invalid = downloaded;
                if (!(invalid.getName().endsWith(".bat") || invalid.getName().endsWith(".sh") || invalid.getName().endsWith(".sig"))) { // Windows & Linux don't like deleted scripts while execution!
                    invalid.deleteOnExit();
                }
            }
        }
        // latest downloaded release
        yacyVersion dflt = (downloadedReleases.isEmpty()) ? null : downloadedReleases.last();
View Full Code Here

      numTries++;
    }
    if ( ! success )
      return null;

    newDir.deleteOnExit();
    return newDir;
  }

  /**
   * Create a new directory for the given path. Fails if the directory already
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.