Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/***************************************
 *            ViPER                    *
 *  The Video Processing               *
 *         Evaluation Resource         *
 *                                     *
 *  Distributed under the GPL license  *
 *        Terms available at gnu.org.  *
 *                                     *
 *  Copyright University of Maryland,  *
 *                      College Park.  *
 ***************************************/

import java.io.*;
import java.net.*;

public class Main {
    private static final String charset = "UTF-8";

    /**
     * Combined the namespace and the local name back together.
     * @param ns the namespace uri
     * @param lname the local name
     * @return the joined uri
     */
    public static String unsplit(String ns, String lname) {
        return unsplit(ns, lname, "#");
    }

    /**
     * Combined the namespace and the local name back together.
     * @param ns the namespace uri
     * @param lname the local name
     * @param joiner the join string, e.g. <code>#</code>
     * @return the joined uri
     */
    public static String unsplit(String ns, String lname, String joiner) {
        if (!ns.endsWith(joiner)) {
            ns += joiner;
        }
        try {
            return ns + URLEncoder.encode(lname, charset);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("You don't support " + charset + "?");
        }
    }
}