drools-eclipse/org.guvnor.eclipse.webdav/src/interface/org/eclipse/webdav/internal/utils/URLEncoder.java
public static String encode(String file, String ref) {
        StringBuffer buf = new StringBuffer();
        StringTokenizer tokenizer = new StringTokenizer(file, "/", true); //$NON-NLS-1$

        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            if (token.equals("/")) { //$NON-NLS-1$
                buf.append(token);
            } else {
                buf.append(encodeSegment(token));
            }
        }

        if (ref != null) {
            buf.append('#');
            buf.append(encodeSegment(ref));
        }

        return buf.toString();
    }
public static String encode(String file, String ref) {
        StringBuffer buf = new StringBuffer();
        StringTokenizer tokenizer = new StringTokenizer(file, "/", true); //$NON-NLS-1$

        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            if (token.equals("/")) { //$NON-NLS-1$
                buf.append(token);
            } else {
                buf.append(encodeSegment(token));
            }
        }

        if (ref != null) {
            buf.append('#');
            buf.append(encodeSegment(ref));
        }

        return buf.toString();
    }
public static String encode ( String file , String ref ) { StringBuffer buf = new StringBuffer ( ) ; StringTokenizer tokenizer = new StringTokenizer ( file , "/" , true ) ; //$NON-NLS-1$ while ( tokenizer . hasMoreTokens ( ) ) { String token = tokenizer . nextToken ( ) ; if ( token . equals ( "/" ) ) { //$NON-NLS-1$ buf . append ( token ) ; } else { buf . append ( encodeSegment ( token ) ) ; } } if ( ref != null ) { buf . append ( ' ' ) ; buf . append ( encodeSegment ( ref ) ) ; } return buf . toString ( ) ; }
Encodes the given file and reference parts of a <code>URL</code> into
an <code>ASCII</code> readable <code>String</code> that is safe for
transport. Returns the result.

@return the result of encoding the given file and reference parts of
a <code>URL</code> into an <code>ASCII</code> readable
<code>String</code> that is safe for transport
Encodes the given file and reference parts of a <code > URL< / code > into an <code > ASCII< / code > readable <code > String< / code > that is safe for transport . Returns the result .