本文整理汇总了Java中org.tigris.subversion.svnclientadapter.SVNUrl.getPathSegments方法的典型用法代码示例。如果您正苦于以下问题:Java SVNUrl.getPathSegments方法的具体用法?Java SVNUrl.getPathSegments怎么用?Java SVNUrl.getPathSegments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.tigris.subversion.svnclientadapter.SVNUrl
的用法示例。
在下文中一共展示了SVNUrl.getPathSegments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RepositoryFile
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入方法依赖的package包/类
public RepositoryFile(SVNUrl repositoryUrl, SVNUrl fileUrl, SVNRevision revision) {
this(repositoryUrl, revision);
this.fileUrl = fileUrl;
repositoryRoot = fileUrl == null;
if(!repositoryRoot) {
String[] fileUrlSegments = fileUrl.getPathSegments();
int fileSegmentsLength = fileUrlSegments.length;
int repositorySegmentsLength = repositoryUrl.getPathSegments().length;
pathSegments = new String[fileSegmentsLength - repositorySegmentsLength];
StringBuffer sb = new StringBuffer();
for (int i = repositorySegmentsLength; i < fileSegmentsLength; i++) {
pathSegments[i-repositorySegmentsLength] = fileUrlSegments[i];
sb.append(fileUrlSegments[i]);
if(i-repositorySegmentsLength < pathSegments.length-1) {
sb.append("/"); // NOI18N
}
}
path = sb.toString();
}
}
示例2: makeCliUrlString
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入方法依赖的package包/类
private String makeCliUrlString(SVNUrl url, boolean appendAtSign) {
String cliUrlString = encodeUrl(url).toString();
if (appendAtSign) {
for (String pathSegment : url.getPathSegments()) {
if (pathSegment.indexOf('@') != -1) {
cliUrlString += '@';
break;
}
}
}
return cliUrlString;
}
示例3: parseUrlString
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入方法依赖的package包/类
private void parseUrlString(String urlString) throws MalformedURLException {
int idx = urlString.lastIndexOf('@');
int hostIdx = urlString.indexOf("://"); // NOI18N
int firstSlashIdx = urlString.indexOf("/", hostIdx + 3); // NOI18N
if (urlString.contains("\\")) {
throw new MalformedURLException(NbBundle.getMessage(Repository.class, "MSG_Repository_InvalidSvnUrl", urlString)); //NOI18N
}
if(idx < 0 || firstSlashIdx < 0 || idx < firstSlashIdx) {
svnRevision = SVNRevision.HEAD;
} else /*if (acceptRevision)*/ {
if( idx + 1 < urlString.length()) {
String revisionString = ""; // NOI18N
try {
revisionString = urlString.substring(idx + 1);
svnRevision = SvnUtils.getSVNRevision(revisionString);
} catch (NumberFormatException ex) {
throw new MalformedURLException(NbBundle.getMessage(Repository.class, "MSG_Repository_WrongRevision", revisionString)); // NOI18N
}
} else {
svnRevision = SVNRevision.HEAD;
}
urlString = urlString.substring(0, idx);
}
SVNUrl normalizedUrl = removeEmptyPathSegments(new SVNUrl(urlString));
if ("file".equals(normalizedUrl.getProtocol()) && normalizedUrl.getHost() != null //NOI18N
&& normalizedUrl.getPathSegments().length == 0) {
throw new MalformedURLException(NbBundle.getMessage(Repository.class, "MSG_Repository_InvalidSvnUrl", SvnUtils.decodeToString(normalizedUrl))); //NOI18N
}
svnUrl = normalizedUrl;
}
示例4: removeEmptyPathSegments
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入方法依赖的package包/类
private SVNUrl removeEmptyPathSegments(SVNUrl url) throws MalformedURLException {
String[] pathSegments = url.getPathSegments();
StringBuffer urlString = new StringBuffer();
urlString.append(url.getProtocol());
urlString.append("://"); // NOI18N
urlString.append(ripUserFromHost(url.getHost()));
if(url.getPort() > 0) {
urlString.append(":"); // NOI18N
urlString.append(url.getPort());
}
boolean gotSegments = false;
for (int i = 0; i < pathSegments.length; i++) {
if(!pathSegments[i].trim().equals("")) { // NOI18N
gotSegments = true;
urlString.append("/"); // NOI18N
urlString.append(pathSegments[i]);
}
}
try {
if(gotSegments) {
return new SVNUrl(urlString.toString());
} else {
return url;
}
} catch (MalformedURLException ex) {
throw ex;
}
}