net.rim.device.api.ui.text
Class URLTextFilter

java.lang.Object
  extended by net.rim.device.api.ui.text.TextFilter
      extended by net.rim.device.api.ui.text.URLTextFilter

public class URLTextFilter
extends TextFilter

Filters out characters not usable in URL text strings.

This filter accepts all characters except those disallowed by RFC 2396.


Field Summary
 
Fields inherited from class net.rim.device.api.ui.text.TextFilter
ADN_SIM_PHONE, DEFAULT, DEFAULT_SMART_PHONE, EMAIL, FDN_SIM_PHONE, FILENAME, HEXADECIMAL, INTEGER, IP, LOWERCASE, NUMERIC, PHONE, PIN_ADDRESS, REAL_NUMERIC, SIM_PHONE, SMS_PHONE, STYLE_SHIFT, UPPERCASE, URL, VOICEMAIL_PHONE
 
Constructor Summary
URLTextFilter()
          Constructs a new URLTextFilter instance.
 
Method Summary
 char convert(char character, int status)
          Passes character through URL text filter.
 boolean validate(char character)
          Determines if character is a valid URL string character.
 
Methods inherited from class net.rim.device.api.ui.text.TextFilter
convert, get, validate, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

URLTextFilter

public URLTextFilter()
Constructs a new URLTextFilter instance.



Method Detail

convert

public char convert(char character,
                    int status)
Passes character through URL text filter.

Specified by:
convert in class TextFilter
Parameters:
character - Character to translate.
status - Ignored.
Returns:
Returns provided character. On physical keyboard: all provided spaces become full stops except when shift is held/used where it would return a forward slash. On virtual keyboard: all provided full stops will become forward slash and all provided spaces will become a full stop; both are independent of the shift key.

validate

public boolean validate(char character)
Determines if character is a valid URL string character.

URL delimiters are

 < > " 

URL unwise characters are

 | \ ^ [ ] ` 

Note: Despite the fact that they are included in RFC 2396, the "%", "#", "{", and "}" characters are allowed by the filter.

Specified by:
validate in class TextFilter
Parameters:
character - Character to test.
Returns:
False if passed a space, control, delimiter, or unwise URL character (see description); otherwise, true.





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal