Java URI Parse parsePathElements(URI uri)

Here you can find the source of parsePathElements(URI uri)

Description

parse Path Elements

License

Open Source License

Declaration

public static String[] parsePathElements(URI uri) 

Method Source Code

//package com.java2s;
/**************************************************************************************
 * Copyright (C) 2008 EsperTech, Inc. All rights reserved.                            *
 * http://esper.codehaus.org                                                          *
 * http://www.espertech.com                                                           *
 * ---------------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the GPL license       *
 * a copy of which has been included with this distribution in the license.txt file.  *
 **************************************************************************************/

import java.net.URI;

public class Main {
    public static String[] parsePathElements(URI uri) {

        String path = uri.getPath();
        if (path == null) {
            return new String[0];
        }// ww w.jav a  2s . c om
        while (path.startsWith("/")) {
            path = path.substring(1);
        }
        String[] split = path.split("/");
        if ((split.length > 0) && (split[0].length() == 0)) {
            return new String[0];
        }
        return split;
    }
}

Related

  1. parse(final URI uri, boolean decodeQueryParam)
  2. parseAWSUri(URI uri, String defaultAccessKey, String defaultSecretAccessKey)
  3. parseLeaf(final URI uri)
  4. parseParameters(URI uri)
  5. parseParentURI(final URI uri)
  6. parsePorts(URI connectionURI)
  7. parseQuery(String uri)
  8. parseQuery(URI aURI, boolean shouldDecode)
  9. parseQuery(URI uri)