public boolean exists()
    {
        if (_exists)
            return true;

        if (_urlString.endsWith("!/"))
        {
            String file_url=_urlString.substring(4,_urlString.length()-2);
            try{return newResource(file_url).exists();}
            catch(Exception e) {LogSupport.ignore(log,e); return false;}
        }
        
        boolean check=checkConnection();
        
        // Is this a root URL?
        if (_jarUrl!=null && _path==null)
        {
            // Then if it exists it is a directory
            _directory=check;
            return true;
        }
        else 
        {
            // Can we find a file for it?
            JarFile jarFile=null;
            if (check)
                // Yes
                jarFile=_jarFile;
            else
            {
                // No - so lets look if the root entry exists.
                try
                {
                    jarFile=
                        ((JarURLConnection)
                         ((new URL(_jarUrl)).openConnection())).getJarFile();
                }
                catch(Exception e)
                {
                       LogSupport.ignore(log,e);
                }
            }

            // Do we need to look more closely?
            if (jarFile!=null && _entry==null && !_directory)
            {
                // OK - we have a JarFile, lets look at the entries for our path
                Enumeration e=jarFile.entries();
                while(e.hasMoreElements())
                {
                    JarEntry entry = (JarEntry) e.nextElement();
                    String name=entry.getName().replace('\\','/');
                    
                    // Do we have a match
                    if (name.equals(_path))
                    {
                        _entry=entry;
                        // Is the match a directory
                        _directory=_path.endsWith("/");
                        break;
                    }
                    else if (_path.endsWith("/"))
                    {
                        if (name.startsWith(_path))
                        {
                            _directory=true;
                            break;
                        }
                    }
                    else if (name.startsWith(_path) && name.length()>_path.length() && name.charAt(_path.length())=='/')
                    {
                        _directory=true;
                        break;
                    }
                }
            }
        }    
        
        _exists= ( _directory || _entry!=null);
        return _exists;
    }
public boolean exists ( ) { if ( _exists ) return true ; if ( _urlString . endsWith ( "!/" ) ) { String file_url = _urlString . substring ( 4 , _urlString . length ( ) - 2 ) ; try { return newResource ( file_url ) . exists ( ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; return false ; } } boolean check = checkConnection ( ) ; if ( _jarUrl != null && _path == null ) { _directory = check ; return true ; } else { JarFile jarFile = null ; if ( check ) jarFile = _jarFile ; else { try { jarFile = ( ( JarURLConnection ) ( ( new URL ( _jarUrl ) ) . openConnection ( ) ) ) . getJarFile ( ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } } if ( jarFile != null && _entry == null && ! _directory ) { Enumeration e = jarFile . entries ( ) ; while ( e . hasMoreElements ( ) ) { JarEntry entry = ( JarEntry ) e . nextElement ( ) ; String name = entry . getName ( ) . replace ( '\\' , '/' ) ; if ( name . equals ( _path ) ) { _entry = entry ; _directory = _path . endsWith ( "/" ) ; break ; } else if ( _path . endsWith ( "/" ) ) { if ( name . startsWith ( _path ) ) { _directory = true ; break ; } } else if ( name . startsWith ( _path ) && name . length ( ) > _path . length ( ) && name . charAt ( _path . length ( ) ) == '/' ) { _directory = true ; break ; } } } } _exists = ( _directory || _entry != null ) ; return _exists ; }
Returns true if the respresenetd resource exists.