public Iterable indexedNames()

in org.eclipse.sisu.inject/src/org/eclipse/sisu/space/IndexedClassFinder.java [70:114]


    public Iterable<String> indexedNames( final ClassSpace space )
    {
        final Enumeration<URL> indices;

        if ( null == localPath )
        {
            indices = space.getResources( indexName );
        }
        else
        {
            indices = space.findEntries( localPath, indexName, false );
        }

        final Set<String> names = new LinkedHashSet<String>();
        while ( indices.hasMoreElements() )
        {
            final URL url = indices.nextElement();
            try
            {
                final BufferedReader reader =
                    new BufferedReader( new InputStreamReader( Streams.open( url ), "UTF-8" ) );
                try
                {
                    // each index contains a list of class names, one per line with optional comment
                    for ( String line = reader.readLine(); line != null; line = reader.readLine() )
                    {
                        final Matcher m = LINE_PATTERN.matcher( line );
                        if ( m.matches() )
                        {
                            names.add( m.group( 1 ) );
                        }
                    }
                }
                finally
                {
                    reader.close();
                }
            }
            catch ( final IOException e )
            {
                Logs.warn( "Problem reading: {}", url, e );
            }
        }
        return names;
    }