Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.ide.net
Class URLTempFile

java.lang.Object
  extended by oracle.ide.net.URLTempFile

public final class URLTempFile
extends java.lang.Object

The purpose of the URLTempFile class is to provide a local File reference to a document whose location is specified by some URL.

If the URL does not already point to a local file, the URLTempFile instance will copy the document at the URL to a local temporary file and provide a File instance corresponding to that temporary file. Then when the URLTempFile object is garbage colected or when the Java VM exits, the temporary file is deleted automatically.

However, if the specified URL already points to a local file, then URLTempFile will provide a File instance that points directly to the existing file without performing any copying. In this case, the underlying file will not be deleted by URLTempFile, even when the URLTempFile object is garbage collected or the Java VM exits.

To obtain a File reference to the URL content, call the getFile() method. Subsequent calls to getFile will update the locally cached content if necessary. The returned File may be null if there was a problem with getting the content.


Constructor Summary
URLTempFile(java.net.URL url)
          Creates a new URLTempFile.
 
Method Summary
protected  void finalize()
          When the URLTempFile is garbage collected, any temporary file that was created needs to be cleaned up.
 java.io.File getFile()
          Returns a File instance pointing to the document in the local file system that has the same content as the document at the URL specified in the constructor.
 boolean tempWasCreated()
          Returns true if a temporary file was acutally created in the process of providing the File object.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLTempFile

public URLTempFile(java.net.URL url)
Creates a new URLTempFile.

Parameters:
url - The URL of the document for which a local File reference is required. If the URL is null, then the File object will also be null.
Method Detail

getFile

public java.io.File getFile()
Returns a File instance pointing to the document in the local file system that has the same content as the document at the URL specified in the constructor. This may return null if a temporary file could not be created for some reason.


tempWasCreated

public boolean tempWasCreated()
Returns true if a temporary file was acutally created in the process of providing the File object. Returns false if the File points to the exact same document as the URL.


finalize

protected void finalize()
When the URLTempFile is garbage collected, any temporary file that was created needs to be cleaned up.

Overrides:
finalize in class java.lang.Object

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.