Here you can find the source of appendToken(StringBuilder path, String token, boolean skipEmpty, boolean skipSeparator)
private static void appendToken(StringBuilder path, String token, boolean skipEmpty, boolean skipSeparator)
//package com.java2s; /*// ww w. j a v a2s . com * Copyright (c) 2015 The original author or authors. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License v2.0 * which accompanies this distribution. * * The Apache License v2.0 is available at * http://opensource.org/licenses/Apache-2.0 * * You may elect to redistribute this code under this license. */ import java.io.File; public class Main { private static void appendToken(StringBuilder path, String token, boolean skipEmpty, boolean skipSeparator) { if (skipEmpty && (token == null || token.length() == 0)) { // If this is the last token, remove the leading file separator if (skipSeparator) { path.replace(path.length() - 1, path.length(), ""); } return; } path.append(token); if (!skipSeparator) path.append(File.separator); } }