Overview | Package | Class | Tree | Deprecated | Index | Help
| JavaSVN Home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.tmatesoft.svn.core
Class SVNURL

    java.lang.Object
      org.tmatesoft.svn.core.SVNURL

public class SVNURL
extends Object

The SVNURL class is used for representing urls. Those JavaSVN API methods, that need repository locations to carry out an operation, receive a repository location url represented by SVNURL. This class does all the basic work for a caller: parses an original url string (splitting it to components), encodes/decodes a path component to/from the UTF-8 charset, checks for validity (such as protocol support - if JavaSVN does not support a particular protocol, SVNURL throws a corresponding exception).

To create a new SVNURL representation, pass an original url string (like "http://userInfo@host:port/path") to a corresponding parse method of this class.

Version:
  1.0
Author:
  TMate Software Ltd.
See Also:
  Examples

Method Summary
`SVNURL` | `appendPath(String segment, boolean uriEncoded)` Constructs a new SVNURL representation appending a new path segment to the path component of this representation.
`static SVNURL` | `create(String protocol, String userInfo, String host, int port, String path, boolean uriEncoded)` Creates a new SVNURL representation from the given url components.
`boolean` | `equals(Object obj)` Compares this object with another one.
`static int` | `getDefaultPortNumber(String protocol)`
`String` | `getHost()` Returns the host component of the url represented by this object.
`String` | `getPath()` Returns the path component of the url represented by this object as a uri-decoded string
`int` | `getPort()` Returns the port number specified (or default) for the host.
`String` | `getProtocol()` Returns the protocol component of the url represented by this object.
`String` | `getURIEncodedPath()` Returns the path component of the url represented by this object as a uri-encoded string
`String` | `getUserInfo()` Returns the user info component of the url represented by this object.
`int` | `hashCode()` Calculates and returns a hash code for this object.
`boolean` | `hasPort()` Says if the url is provided with a non-default port number or not.
`static SVNURL` | `parseURIDecoded(String url)` Parses the given decoded (not UTF-8 encoded) url string and creates a new SVNURL representation for this url.
`static SVNURL` | `parseURIEncoded(String url)` Parses the given UTF-8 encoded url string and creates a new SVNURL representation for this url.
`SVNURL` | `removePathTail()` Constructs a new SVNURL representation removing a tail path segment from the path component of this representation.
`SVNURL` | `setPath(String path, boolean uriEncoded)` Creates a new SVNURL object replacing a path component of this object with a new provided one.
`String` | `toDecodedString()` Returns a string representing a decoded url.
`String` | `toString()` Returns a string representing a UTF-8 encoded url.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### create

    public static SVNURL create(String protocol,
                                String userInfo,
                                String host,
                                int port,
                                String path,
                                boolean uriEncoded)
                         throws SVNException

  Creates a new SVNURL representation from the given url components.

  Parameters:
    `protocol` - a protocol component
    `userInfo` - a user info component
    `host` - a host component
    `port` - a port number
    `path` - a path component
    `uriEncoded` - true if `path` is UTF-8 encoded, false otherwise
  Returns:
    a new SVNURL representation
  Throws:
    `SVNException` - if the resultant url (composed of the given components) is malformed

### parseURIDecoded

    public static SVNURL parseURIDecoded(String url)
                                  throws SVNException

  Parses the given decoded (not UTF-8 encoded) url string and creates a new SVNURL representation for this url.

  Parameters:
    `url` - an input url string (like 'http://myhost/mypath')
  Returns:
    a new SVNURL representation of `url`
  Throws:
    `SVNException` - if `url` is malformed

### parseURIEncoded

    public static SVNURL parseURIEncoded(String url)
                                  throws SVNException

  Parses the given UTF-8 encoded url string and creates a new SVNURL representation for this url.

  Parameters:
    `url` - an input url string (like 'http://myhost/my%20path')
  Returns:
    a new SVNURL representation of `url`
  Throws:
    `SVNException` - if `url` is malformed

### getDefaultPortNumber

    public static int getDefaultPortNumber(String protocol)

### getProtocol

    public String getProtocol()

  Returns the protocol component of the url represented by this object.

  Returns:
    a protocol name (like `http`)

### getHost

    public String getHost()

  Returns the host component of the url represented by this object.

  Returns:
    a host name

### getPort

    public int getPort()

  Returns the port number specified (or default) for the host.

  Returns:
    a port number

### hasPort

    public boolean hasPort()

  Says if the url is provided with a non-default port number or not.

  Returns:
    true if the url comes with a non-default port number, false otherwise
  See Also:
    `getPort()`

### getPath

    public String getPath()

  Returns the path component of the url represented by this object as a uri-decoded string

  Returns:
    a uri-decoded path

### getURIEncodedPath

    public String getURIEncodedPath()

  Returns the path component of the url represented by this object as a uri-encoded string

  Returns:
    a uri-encoded path

### getUserInfo

    public String getUserInfo()

  Returns the user info component of the url represented by this object.

  Returns:
    a user info part of the url (if it was provided)

### toString

    public String toString()

  Returns a string representing a UTF-8 encoded url.

  Returns:
    an encoded url string

### toDecodedString

    public String toDecodedString()

  Returns a string representing a decoded url.

  Returns:
    a decoded url string

### appendPath

    public SVNURL appendPath(String segment,
                             boolean uriEncoded)
                      throws SVNException

  Constructs a new SVNURL representation appending a new path segment to the path component of this representation.

  Parameters:
    `segment` - a new path segment
    `uriEncoded` - true if `segment` is UTF-8 encoded, false otherwise
  Returns:
    a new SVNURL representation
  Throws:
    `SVNException` - if a parse error occurred

### setPath

    public SVNURL setPath(String path,
                          boolean uriEncoded)
                   throws SVNException

  Creates a new SVNURL object replacing a path component of this object with a new provided one.

  Parameters:
    `path` - a path component
    `uriEncoded` - true if `path` is UTF-8 encoded
  Returns:
    a new SVNURL representation
  Throws:
    `SVNException` - if a parse error occurred

### removePathTail

    public SVNURL removePathTail()
                          throws SVNException

  Constructs a new SVNURL representation removing a tail path segment from the path component of this representation.

  Returns:
    a new SVNURL representation
  Throws:
    `SVNException`

### equals

    public boolean equals(Object obj)

  Compares this object with another one.

  Parameters:
    `obj` - an object to compare with
  Returns:
    true if `obj` is an instance of SVNURL and has got the same url components as this object has

### hashCode

    public int hashCode()

  Calculates and returns a hash code for this object.

  Returns:
    a hash code value

Overview | Package | Class | Tree | Deprecated | Index | Help
| JavaSVN Home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 TMate Software Ltd. All Rights Reserved.