This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
<api name="filesystems"/>
<summary>There should exist just one FileObject for one resource (java.io.File or URL). </summary>
<version major="4" minor="29"/>
<date day="9" month="4" year="2004"/>
<author login="rmatous"/>
<compatibility addition="yes" modification="yes" deprecation="yes" semantic="compatible"/>
<description>
<ul>
<li>Added method FileUtil.toFileObject as replacement for current method FileUtil.fromFile which was deprecated.</li>
<li>Added method URLMapper.findFileObject as replacement for current method URLMapper.findFileObjects which was deprecated .</li>
</ul>
</description>
<class package="org.openide.filesystems" name="FileUtil"/>
<class package="org.openide.filesystems" name="URLMapper"/>
<issue number="41506"/>
</change>
<change>
* If not possible then null is returned.
* @param file File whose coresponding FileObjects will be looked for
* @return corresponding FileObject or null
* @since X.XX
*/
public static FileObject toFileObject (File file) {
FileObject[] fileObjects = fromFile (file);
return (fileObjects != null && fileObjects.length > 0) ? fileObjects[0] : null;
}
/** Finds appropriate FileObjects to java.io.File if possible.
* @deprecated Use method {@link #toFileObject toFileObject}
return findFileObject(getArchiveRoot(archiveURL));
return URLMapper.findFileObject(getArchiveRoot(archiveURL));
--
FileObject fo = findFileObject(url);
FileObject fo = URLMapper.findFileObject(url);
* @since 2.22*/
* @since 2.22
* @deprecated use method {@link #findFileObject findFileObject}
/** Get an array of FileObjects for this url
/** Find an appropiate instance of FileObject that addresses this url
*
* @param url url to be converted to file object
* @return file object corresponding to url or null if no one was found
public static FileObject findFileObject (URL url) {
FileObject fos[] = URLMapper.findFileObjects(url);
if (fos.length == 0) {
return null;
// prefer file object from master filesystem
for (int i=0; i<fos.length; i++) {
if (fos[i].getClass().getName().indexOf("masterfs") != -1) { //NOI18N
return fos[i];
return fos[0];
/** Get an array of FileObjects for this url. There is no reason to return array
* with size greater than one because method {@link #findFileObject findFileObject}
* uses just first element (next elements won't be accepted anyway).
* <p class="nonnormative"> There isn't necessary to return array here.
* The only one reason is just backward compatibility.</p>
* @return a suitable arry of FileObjects, or null
* @return an array of FileObjects with size no greater than one, or null