bundles/org.eclipse.packagedrone.repo.channel.impl/src/org/eclipse/packagedrone/repo/channel/impl/transfer/TransferServiceImpl.java
private Map<MetaKey, String> readProperties ( final InputStream stream ) throws IOException
    {
        try
        {
            // wrap the input stream since we don't want the XML parser to close the stream while parsing

            final Document doc = this.xmlToolsFactory.newDocumentBuilder ().parse ( new FilterInputStream ( stream ) {
                @Override
                public void close ()
                {
                    // do nothing
                }
            } );

            final Element root = doc.getDocumentElement ();
            if ( !"properties".equals ( root.getNodeName () ) )
            {
                throw new IllegalStateException ( String.format ( "Root element must be of type '%s'", "properties" ) );
            }

            final Map<MetaKey, String> result = new HashMap<> ();

            for ( final Element ele : XmlHelper.iterElement ( root, "property" ) )
            {
                final String namespace = ele.getAttribute ( "namespace" );
                final String key = ele.getAttribute ( "key" );
                final String value = ele.getTextContent ();

                if ( namespace.isEmpty () || key.isEmpty () )
                {
                    continue;
                }

                result.put ( new MetaKey ( namespace, key ), value );
            }

            return result;
        }
        catch ( final Exception e )
        {
            throw new IOException ( "Failed to read properties", e );
        }
    }
private Map<MetaKey, String> readProperties ( final InputStream stream ) throws IOException
    {
        try
        {
            // wrap the input stream since we don't want the XML parser to close the stream while parsing

            final Document doc = this.xmlToolsFactory.newDocumentBuilder ().parse ( new FilterInputStream ( stream ) {
                @Override
                public void close ()
                {
                    // do nothing
                }
            } );

            final Element root = doc.getDocumentElement ();
            if ( !"properties".equals ( root.getNodeName () ) )
            {
                throw new IllegalStateException ( String.format ( "Root element must be of type '%s'", "properties" ) );
            }

            final Map<MetaKey, String> result = new HashMap<> ();

            for ( final Element ele : XmlHelper.iterElement ( root, "property" ) )
            {
                final String namespace = ele.getAttribute ( "namespace" );
                final String key = ele.getAttribute ( "key" );
                final String value = ele.getTextContent ();

                if ( namespace.isEmpty () || key.isEmpty () )
                {
                    continue;
                }

                result.put ( new MetaKey ( namespace, key ), value );
            }

            return result;
        }
        catch ( final Exception e )
        {
            throw new IOException ( "Failed to read properties", e );
        }
    }
private Map < MetaKey , String > readProperties ( final InputStream stream ) throws IOException { try { // wrap the input stream since we don't want the XML parser to close the stream while parsing final Document doc = this . xmlToolsFactory . newDocumentBuilder ( ) . parse ( new FilterInputStream ( stream ) { @ Override public void close ( ) { // do nothing } } ) ; final Element root = doc . getDocumentElement ( ) ; if ( ! "properties" . equals ( root . getNodeName ( ) ) ) { throw new IllegalStateException ( String . format ( "Root element must be of type '%s'" , "properties" ) ) ; } final Map < MetaKey , String > result = new HashMap <> ( ) ; for ( final Element ele : XmlHelper . iterElement ( root , "property" ) ) { final String namespace = ele . getAttribute ( "namespace" ) ; final String key = ele . getAttribute ( "key" ) ; final String value = ele . getTextContent ( ) ; if ( namespace . isEmpty ( ) || key . isEmpty ( ) ) { continue ; } result . put ( new MetaKey ( namespace , key ) , value ) ; } return result ; } catch ( final Exception e ) { throw new IOException ( "Failed to read properties" , e ) ; } }
Read in a map of properties

@param stream
input stream
@return the map of properties
@throws IOException
if anything goes wrong reading the file
Read in a map of properties