superwaba.ext.xplat.io.http
Class URI

java.lang.Object
  |
  +--superwaba.ext.xplat.io.http.URI

public class URI
extends java.lang.Object

Break a URI into its several components.


Inner Class Summary
static class URI.Path
          Class for the path component of this URI.
 
Field Summary
 ByteString authority
           
 ByteString fragment
           
 ByteString host
           
 URI.Path path
           
 int port
           
 ByteString query
           
 ByteString scheme
           
 ByteString userInfo
           
 
Constructor Summary
URI(byte[] spec, int start, int len)
          Constructor from a byte array.
URI(byte[] spec, int start, int len, URI baseURI)
          Constructor from a byte array, and a base URI missing components derive from.
URI(java.lang.String spec)
          Constructor from a String
URI(java.lang.String spec, URI baseURI)
          Constructor from a String and a base URI
 
Method Summary
static java.lang.String decode(java.lang.String val)
          Decodes a application/x-www-form-urlencoded string
static void decode(java.lang.String val, java.lang.StringBuffer sb)
          Decodes a application/x-www-form-urlencoded string
static java.lang.String encode(java.lang.String val)
          Encodes to a application/x-www-form-urlencoded
static void encode(java.lang.String val, java.lang.StringBuffer sb)
          Encodes to a application/x-www-form-urlencoded
 java.lang.String toString()
          Return a String representation of this URI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scheme

public ByteString scheme

authority

public ByteString authority

userInfo

public ByteString userInfo

host

public ByteString host

path

public URI.Path path

query

public ByteString query

fragment

public ByteString fragment

port

public int port
Constructor Detail

URI

public URI(java.lang.String spec)
Constructor from a String
Parameters:
spec - String that holds the specified URI

URI

public URI(java.lang.String spec,
           URI baseURI)
Constructor from a String and a base URI
Parameters:
spec - String that holds the specified URI
baseURI - base URI for deriving relative components

URI

public URI(byte[] spec,
           int start,
           int len)
Constructor from a byte array.
Parameters:
spec - byte array that holds the specified URI
start - where the URI starts in the byte array
len - length of the URI

URI

public URI(byte[] spec,
           int start,
           int len,
           URI baseURI)
Constructor from a byte array, and a base URI missing components derive from.
Parameters:
spec - byte array that holds the specified URI
start - where the URI starts in the byte array
len - length of the URI
baseURI - base URI for deriving relative components
Method Detail

toString

public java.lang.String toString()
Return a String representation of this URI
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this URI

encode

public static java.lang.String encode(java.lang.String val)
Encodes to a application/x-www-form-urlencoded
Parameters:
val - the String to encode
Returns:
the encoded String.

decode

public static java.lang.String decode(java.lang.String val)
Decodes a application/x-www-form-urlencoded string
Parameters:
val - the String to decode
Returns:
the decoded String.

encode

public static void encode(java.lang.String val,
                          java.lang.StringBuffer sb)
Encodes to a application/x-www-form-urlencoded
Parameters:
val - the String to encode
sb - the StringBuffer where to write the encoded form

decode

public static void decode(java.lang.String val,
                          java.lang.StringBuffer sb)
Decodes a application/x-www-form-urlencoded string
Parameters:
val - the String to decode
sb - the StringBuffer where to write the decoded form