Tabnine Logo
SVNEncodingUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
SVNEncodingUtil
in
org.tmatesoft.svn.core.internal.util

Best Java code snippets using org.tmatesoft.svn.core.internal.util.SVNEncodingUtil (Showing top 20 results out of 315)

origin: org.tmatesoft.svnkit/svnkit

public static Map translateLockTokens(Map lockTokens, String baseURL) {
  Map translatedLocks = new TreeMap();
  for (Iterator urls = lockTokens.keySet().iterator(); urls.hasNext();) {
    String url = (String) urls.next();
    String token = (String) lockTokens.get(url);
    url = url.equals(baseURL) ? "" : url.substring(baseURL.length() + 1);
    translatedLocks.put(SVNEncodingUtil.uriDecode(url), token);
  }
  lockTokens.clear();
  lockTokens.putAll(translatedLocks);
  return lockTokens;
}
origin: org.tmatesoft/svn

public void linkPath(SVNURL url, String path, String locktoken, long revision, boolean startEmpty) throws SVNException {
  report.append("<S:entry rev=\"");
  report.append(revision);
  report.append("\" ");
  if (locktoken != null) {
    report.append("lock-token=\"");
    report.append(locktoken);
    report.append("\" ");
  }
  if (startEmpty) {
    report.append("start-empty=\"true\" ");
  }
  String linkedPath = url.getURIEncodedPath();
  DAVBaselineInfo info = DAVUtil.getBaselineInfo(connection, null, linkedPath, revision, false, false, null);
  String switchUrl = SVNEncodingUtil.uriDecode(info.baselinePath);
  report.append("linkpath=\"");
  // switched path relative to connection root.
  report.append(SVNEncodingUtil.xmlEncodeAttr(switchUrl));
  report.append("\" ");
  report.append(">");
  report.append(SVNEncodingUtil.xmlEncodeCDATA(path));
  report.append("</S:entry>\n");
}
origin: org.tmatesoft/svn

private static StringBuffer appendProperty(StringBuffer buffer, String name, String value) {
  buffer.append("<");
  int index = buffer.length();
  if (name.startsWith("svn:")) {
    buffer.append("S:");
    buffer.append(name.substring("svn:".length()));
  } else {
    buffer.append("C:");
    buffer.append(name);
  }
  int index2 = buffer.length();
  if (value == null) {
    return buffer.append(" />");
  }
  if (SVNEncodingUtil.isXMLSafe(value)) {
    value = SVNEncodingUtil.xmlEncodeCDATA(value);            
  } else {
    value = SVNBase64.byteArrayToBase64(value.getBytes());
    buffer.append(" V:encoding=\"base64\"");
  }
  buffer.append(">");
  buffer.append(value);
  buffer.append("</");
  buffer.append(buffer.substring(index, index2));
  return buffer.append(">");        
}
origin: org.tmatesoft.svnkit/svnkit

public static String fuzzyEscape(String str) {
  char[] chars = str.toCharArray();
  StringBuffer result = createStringBuffer(str, 0);
  for (int i = 0; i < chars.length; i++) {
    if (!isASCIIControlChar(chars[i]) || chars[i] == '\r'
        || chars[i] == '\n' || chars[i] == '\t') {
      result.append(chars[i]);
    } else {
      result.append("?\\");
      int code = chars[i] & 0xFF;
      if (code < 100) {
        result.append('0');
      }
      result.append(code);
    }
  }
  return result.toString();
}
origin: org.tmatesoft.svnkit/svnkit

/**
 * Creates a new <b>SVNURL</b> object replacing a path component of 
 * this object with a new provided one. 
 * 
 * @param  path            a path component
 * @param  uriEncoded      <span class="javakeyword">true</span> if <code>path</code> 
 *                         is UTF-8 encoded
 * @return                 a new <b>SVNURL</b> representation                 
 * @throws SVNException    if a parse error occurred
 */
public SVNURL setPath(String path, boolean uriEncoded) throws SVNException {
  if (path == null || "".equals(path)) {
    path = "/";
  }
  if (!uriEncoded) {
    path = SVNEncodingUtil.uriEncode(path);
  } else {
    path = SVNEncodingUtil.autoURIEncode(path);
  }
  String url = composeURL(getProtocol(), getUserInfo(), getHost(), myIsDefaultPort ? -1 : getPort(), path);
  return parseURIEncoded(url);
}

origin: org.tmatesoft/svn

if (uriEncoded) {
  myEncodedPath = SVNEncodingUtil.autoURIEncode(testPath);
  SVNEncodingUtil.assertURISafe(myEncodedPath);
  myPath = SVNEncodingUtil.uriDecode(myEncodedPath);
  myPath = myPath.replace(File.separatorChar, '/');
  if(!myPath.startsWith("/")){
    myPath = "/" + myPath;
  myEncodedPath = SVNEncodingUtil.uriEncode(myPath);
if (uriEncoded) {
  myEncodedPath = SVNEncodingUtil.autoURIEncode(httpPath);
  SVNEncodingUtil.assertURISafe(myEncodedPath);
  myPath = SVNEncodingUtil.uriDecode(myEncodedPath);
} else {
  myPath = httpPath;
  myEncodedPath = SVNEncodingUtil.uriEncode(myPath);
origin: org.tmatesoft.svnkit/svnkit

public static String xmlEncodeCDATA(String src) {
  return xmlEncodeCDATA(src, false);
}
origin: org.tmatesoft.svnkit/svnkit-cli

} else {
  if (SVNCommandUtil.isURL(path)) {
    path = SVNEncodingUtil.autoURIEncode(path);
    try {
      SVNEncodingUtil.assertURISafe(path);
    } catch (SVNException e) {
      SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_URL, "URL '" + path + "' is not properly URI-encoded");
origin: org.tmatesoft.svnkit/svnkit-javahl16

public static boolean isValid(String path) {
  if (path == null) {
    return false;
  }
  for(int i = 0; i < path.length(); i++) {
    char ch = path.charAt(i);
    if (SVNEncodingUtil.isASCIIControlChar(ch)) {
      return false;
    }
  }
  return true;
}
origin: org.codehaus.jtstand/jtstand-svnkit

isXMLSafe = SVNEncodingUtil.isXMLSafe(stringValue);
origin: org.nuiton/scmwebeditor-svn

@Override
public String getRepositoryId() {
  String repositoryUUID;
  try {
    String encodedUrl = SVNEncodingUtil.autoURIEncode(addressSvn);
    SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(encodedUrl));
    ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager();
    repository.setAuthenticationManager(svnAuthManager);
    repositoryUUID = repository.getRepositoryUUID(true);
  } catch (SVNException e) {
    if (log.isDebugEnabled()) {
      log.debug("Can't get UUID", e);
    }
    return null;
  }
  return repositoryUUID;
}
origin: org.tmatesoft.svnkit/svnkit

public String getURL() {
  if (url == null && parentURL != null) {
    return SVNPathUtil.append(parentURL, SVNEncodingUtil.uriEncode(myName));
  }
  return url;
}
origin: sonia.svnkit/svnkit-dav

  SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "date", propValue, null, false, true, xmlBuffer);
} else if (SVNRevisionProperty.LOG.equals(propName)) {
  String comment = SVNEncodingUtil.fuzzyEscape(propValue);
  SVNXMLUtil.openCDataTag(SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.COMMENT.getName(), comment, null, false, true, xmlBuffer);
} else {
  noCustomProperties = false;
  String encodedPropName = SVNEncodingUtil.xmlEncodeCDATA(propName, false);
  SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "revprop", propValue, NAME_ATTR, encodedPropName, false, 
      true, xmlBuffer);
origin: org.tmatesoft/svn

protected void addAttribute(String name, String value) {        
  if (mySharedAttributes == null) {
    mySharedAttributes = new AttributesImpl();
  }
  mySharedAttributes.addAttribute("", "", name, "CDATA", SVNEncodingUtil.xmlEncodeAttr(value));
}
origin: org.tmatesoft/svn

    addAttribute(ACTION_ATTR, path.getType() + "");
    if (path.getCopyPath() != null) {
      addAttribute(COPYFROM_PATH_ATTR, SVNEncodingUtil.xmlEncodeAttr(path.getCopyPath()));
      addAttribute(COPYFROM_REV_ATTR, path.getCopyRevision() + "");
    addTag(PATH_TAG, SVNEncodingUtil.xmlEncodeAttr(path.getPath()));
message = SVNEncodingUtil.xmlEncodeCDATA(message);
addTag(MSG_TAG, message);
closeTag(LOGENTRY_TAG);
origin: org.tmatesoft/svn

public static String fuzzyEscape(String str) {
  byte[] bytes = str.getBytes(); // native encoding
  StringBuffer result = createStringBuffer(str, 0);
  for (int i = 0; i < bytes.length; i++) {
    if (bytes[i] >= 0) {
      result.append((char) bytes[i]);
    } else {
      result.append("?\\");
      result.append((256 - (-bytes[i]))); // get positive code (256 - b).
    }
  }
  return result.toString();
}
origin: org.codehaus.jtstand/jtstand-svnkit

/**
 * Creates a new <b>SVNURL</b> object replacing a path component of 
 * this object with a new provided one. 
 * 
 * @param  path            a path component
 * @param  uriEncoded      <span class="javakeyword">true</span> if <code>path</code> 
 *                         is UTF-8 encoded
 * @return                 a new <b>SVNURL</b> representation                 
 * @throws SVNException    if a parse error occurred
 */
public SVNURL setPath(String path, boolean uriEncoded) throws SVNException {
  if (path == null || "".equals(path)) {
    path = "/";
  }
  if (!uriEncoded) {
    path = SVNEncodingUtil.uriEncode(path);
  } else {
    path = SVNEncodingUtil.autoURIEncode(path);
  }
  String url = composeURL(getProtocol(), getUserInfo(), getHost(), myIsDefaultPort ? -1 : getPort(), path);
  return parseURIEncoded(url);
}

origin: org.jvnet.hudson.svnkit/svnkit

public static String xmlEncodeCDATA(String src) {
  return xmlEncodeCDATA(src, false);
}
origin: sonia.svnkit/svnkit-cli

} else {
  if (SVNCommandUtil.isURL(path)) {
    path = SVNEncodingUtil.autoURIEncode(path);
    try {
      SVNEncodingUtil.assertURISafe(path);
    } catch (SVNException e) {
      SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_URL, "URL '" + path + "' is not properly URI-encoded");
origin: org.codehaus.jtstand/jtstand-svnkit

public static boolean isValid(String path) {
  if (path == null) {
    return false;
  }
  for(int i = 0; i < path.length(); i++) {
    char ch = path.charAt(i);
    if (SVNEncodingUtil.isASCIIControlChar(ch)) {
      return false;
    }
  }
  return true;
}
org.tmatesoft.svn.core.internal.utilSVNEncodingUtil

Most used methods

  • uriDecode
  • autoURIEncode
  • xmlEncodeCDATA
  • fuzzyEscape
  • isXMLSafe
  • assertURISafe
  • isASCIIControlChar
  • uriEncode
  • xmlEncodeAttr
  • createStringBuffer
  • hexValue
  • isHexDigit
  • hexValue,
  • isHexDigit,
  • xmlDecode,
  • clearArray,
  • copyOf,
  • getBytes,
  • getChars

Popular in Java

  • Reactive rest calls using spring rest template
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Reference (javax.naming)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now