Package java.io

Examples of java.io.File.deleteOnExit()


  }

  public boolean exportPrograms(Program[] programs, CalendarExportSettings settings, AbstractPluginProgramFormating formating) {
    try {
      File file = File.createTempFile("tvbrowser", ".ics");
      file.deleteOnExit();
     
      ICalFile ical = new ICalFile();
      ical.export(file, programs, settings, formating);
     
      new ExecutionHandler("--merge " + file.getAbsolutePath(), "korganizer").execute();
View Full Code Here


  public void testGetResource_FileOutsideOfClasspath() throws Exception {
    // Create temp file.
    File temp = File.createTempFile("dozerfiletest", ".txt");

    // Delete temp file when program exits.
    temp.deleteOnExit();

    String resourceName = "file:" + temp.getAbsolutePath();
    URL url = loader.getResource(resourceName);
    assertNotNull("URL should not be null", url);
View Full Code Here

        try {
            file.createNewFile();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        file.deleteOnExit();
        return file;
    }

    protected StartParameter createStartParams(boolean searchUpwards) {
        StartParameter startParameter = new StartParameter();
View Full Code Here

        assertEquals(data.length, data2.length);
       
        assertEquals(XMLStreamReader.END_ELEMENT, reader.getEventType());
       
        fis.close();
        file.deleteOnExit();
    }
   
}
View Full Code Here

      catch( OutOfMemoryError e ) {
        outOfMemoryError = true;
        try {
          // We try at all costs to avoid out-of-memory errors: we dump the buffer, try to allocate a slightly larger array and reload it.
          File temp = File.createTempFile( ByteArrayPostingList.class.getSimpleName(), "dump" );
          temp.deleteOnExit();
          BinIO.storeBytes( buffer, temp );
          buffer = null;
          buffer = new byte[ oldLength + POSTINGS_EMERGENCY_INCREMENT ];
          BinIO.loadBytes( temp, buffer );
          temp.delete();
View Full Code Here

        catch( OutOfMemoryError e ) {
          outOfMemoryError = true;
          try {
            // We try at all costs to avoid out-of-memory errors: we dump the buffer, try to allocate a slightly larger array and reload it.
            File temp = File.createTempFile( ByteArrayPostingList.class.getSimpleName(), "dump" );
            temp.deleteOnExit();
            BinIO.storeInts( position, temp );
            final int oldLength = position.length;
            position = null;
            position = new int[ oldLength + POSITIONS_EMERGENCY_INCREMENT ];
            BinIO.loadInts( temp, position );
View Full Code Here

        final ProgressLogger pl = new ProgressLogger();
        pl.itemsName = "URIs";
        pl.start( "Copying URIs..." );
        final LineIterator termIterator = new LineIterator( new FastBufferedReader( new InputStreamReader( new FileInputStream( termFile ) ), bufferSize ), pl );
        File temp = File.createTempFile( URLMPHVirtualDocumentResolver.class.getName(), ".uniqueuris" );
        temp.deleteOnExit();
        termFile = temp.toString();
        final FastBufferedOutputStream outputStream = new FastBufferedOutputStream( new FileOutputStream( termFile ), bufferSize );
        MutableString uri;
        while( termIterator.hasNext() ) {
          uri = termIterator.next();
View Full Code Here

                    } else if (name.toLowerCase().endsWith(".properties")) {
                        writeToFile(bis, new File(DataCrow.moduleDir, name));
                    } else if (name.toLowerCase().endsWith(".xml")) {
                        File file =  new File(System.getProperty("java.io.tmpdir"), name);
                        writeToFile(bis, file);
                        file.deleteOnExit();
                        data.put(name.substring(0, name.toLowerCase().indexOf(".xml")), file);
                    } else if (name.toLowerCase().endsWith(".jar")) {
                        // check if the custom module does not already exist
                        if (DcModules.get(name.substring(0, name.indexOf(".jar"))) == null) {
                            writeToFile(bis, new File(DataCrow.moduleDir, name));
View Full Code Here

                break;
            }
        }
        if (deleteOnExit) {
            try {
                f.deleteOnExit();
            } catch (Throwable e) {
                // sometimes this throws a NullPointerException
                // at java.io.DeleteOnExitHook.add(DeleteOnExitHook.java:33)
                // we can ignore it
            }
View Full Code Here

        try {
            tmpFile = File.createTempFile(Environment.OpenMapPrefix,
                    ".html",
                    new File(Environment.get(Environment.TmpDir)));

            tmpFile.deleteOnExit(); // get rid of it when the user
                                    // quits.

            FileOutputStream fs = new FileOutputStream(tmpFile);
            PrintWriter out = new PrintWriter((OutputStream) fs);
            out.println(text);
View Full Code Here

TOP
Copyright © 2015 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.