public URL buildURL( ) throws MalformedURLException {
		
		StringBuilder urlString = new StringBuilder( );
		urlString.append( this.proto( ) == null ? DEFAULT_PROTO : this.proto( ) );
		urlString.append( PROTO_SEPARATOR );
		urlString.append( this.host( ) );
		if ( port != null && port > 0 )
			urlString.append( PORT_SEPARATOR + port );
		
		if ( this.path( ) != null )
			urlString.append( path );
		
		if ( this.query( ) != null ) {
			String queryString = buildQuery( this.query( ) );
			if ( queryString != null ) {
				urlString.append( QUERY_SEPARATOR );
				urlString.append( queryString );
			}
		}
		
		if ( this.ref( ) != null )
			urlString.append( REF_SEPARATOR + ref );
		
		return new URL( urlString.toString( ) );
	}