Java Path Normalize normalizeDotSegment(String path)

Here you can find the source of normalizeDotSegment(String path)

Description

normalize Dot Segment

License

Open Source License

Declaration

private static String normalizeDotSegment(String path) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 National University of Ireland, Galway. All Rights Reserved.
 *
 *
 * This project is a free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * This project is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this project. If not, see <http://www.gnu.org/licenses/>.
 *******************************************************************************/

public class Main {
    private static String normalizeDotSegment(String path) {
        // remove dot-segment prefix (not removed by URI#normalize)
        while (path.startsWith("/./") || path.startsWith("/../")) {
            path = path.replaceFirst("/[\\.]+/", "/");
        }//from   w w  w .  j a  v a2s . c  o  m
        return path;
    }
}

Related

  1. normalize(String pathname, int len, int off)
  2. normalize_color_path(int eff_color_path)
  3. normalizeAllSeparators(String path)
  4. normalizeBasePath(String basePath)
  5. normalizeDbPath(String databasePath)
  6. normalizedPath(String original)
  7. normalizeFileSystemPath(String path)
  8. normalizeFullPath(String path)
  9. normalizeLocalPath(final String localPath)