Package com.dotcms.repackage.com.caucho.util

Examples of com.dotcms.repackage.com.caucho.util.CharBuffer


    if (! isWindows())
      return escapeURL("dotcms:" + getFullPath());

    String path = getFullPath();
    int length = path.length();
    CharBuffer cb = new CharBuffer();

    // #2725, server/1495
    cb.append("dotcms:");

    char ch;
    int offset = 0;
    // For windows, convert /c: to c:
    if (length >= 3
        && path.charAt(0) == '/'
          && path.charAt(2) == ':'
            && ('a' <= (ch = path.charAt(1)) && ch <= 'z'
              || 'A' <= ch && ch <= 'Z')) {
      // offset = 1;
    }
    else if (length >= 3
        && path.charAt(0) == '/'
          && path.charAt(1) == ':'
            && path.charAt(2) == '/') {
      cb.append('/');
      cb.append('/');
      cb.append('/');
      cb.append('/');
      offset = 3;
    }

    for (; offset < length; offset++) {
      ch = path.charAt(offset);

      if (ch == '\\')
        cb.append('/');
      else
        cb.append(ch);
    }

    return escapeURL(cb.toString());

  }
View Full Code Here


    if (! isWindows())
      return getFullPath();

    String path = getFullPath();
    int length = path.length();
    CharBuffer cb = new CharBuffer();
    char ch;
    int offset = 0;
    // For windows, convert /c: to c:
    if (isWindows()) {
      if (length >= 3
          && path.charAt(0) == '/'
            && path.charAt(2) == ':'
              && ('a' <= (ch = path.charAt(1)) && ch <= 'z'
                || 'A' <= ch && ch <= 'Z')) {
        offset = 1;
      }
      else if (length >= 3
          && path.charAt(0) == '/'
            && path.charAt(1) == ':'
              && path.charAt(2) == '/') {
        cb.append('\\');
        cb.append('\\');
        offset = 3;
      }
    }

    for (; offset < length; offset++) {
      ch = path.charAt(offset);
      if (ch == '/')
        cb.append(_separatorChar);
      else
        cb.append(ch);
    }

    return cb.close();
  }
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.com.caucho.util.CharBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.