com.dionloy.joogle
Class JGJoogle
java.lang.Object
|
+--com.dionloy.joogle.JGJoogle
- public class JGJoogle
- extends java.lang.Object
JGJoogle is handles the connection to the Google server. This
is generally the class you would use as the entry point for
joogle.
Version: $Version$
|
Field Summary |
static java.lang.String |
kQueryPlaceHolder
Constant used for the '%query%' placeholder. |
|
Constructor Summary |
JGJoogle()
Constructs a new instance of JGJoogle. |
|
Method Summary |
static void |
main(java.lang.String[] args)
Command line tester. |
protected JGDocument |
parseDocumentFromStream(java.io.InputStream inputStream)
Attempts to parse the input stream and returns the JGDocument
if successful. |
JGDocument |
search(java.lang.String queryString)
Opens a new connection to the URL and performs a search. |
void |
setRootURL(java.lang.String rootURL)
Sets the root URL for Google. |
void |
setURL(java.lang.String urlString)
Sets the URL to query Google with. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
kQueryPlaceHolder
public static final java.lang.String kQueryPlaceHolder
- Constant used for the '%query%' placeholder.
JGJoogle
public JGJoogle()
- Constructs a new instance of
JGJoogle.
setURL
public void setURL(java.lang.String urlString)
- Sets the URL to query Google with. The URL should contain a
%query% placeholder which will be replaced with
the appropriate search string. This has a default URL of
http://www.google.com/xml?q=%query%
- Parameters:
urlString - the URL to connect to Google with.
setRootURL
public void setRootURL(java.lang.String rootURL)
- Sets the root URL for Google. This is used by the XML parser
to resolve any references.
search
public JGDocument search(java.lang.String queryString)
throws java.net.MalformedURLException,
java.io.IOException
- Opens a new connection to the URL and performs a search.
- Parameters:
queryString - the search string to query Google with.- Returns:
- an
JGDocument object if successful, null
if not successful. - Throws:
java.net.MalformedURLException -
main
public static void main(java.lang.String[] args)
- Command line tester.
parseDocumentFromStream
protected JGDocument parseDocumentFromStream(java.io.InputStream inputStream)
- Attempts to parse the input stream and returns the JGDocument
if successful.