bass.parser
Class Parsers

java.lang.Object
  extended by bass.parser.Parsers

public class Parsers
extends java.lang.Object

This is supposed to be the class for all functions that do some kind of parsing (html code & stuff)

Version:
0.1
Author:
Thomas Klein, Fabian Winkhardt

Constructor Summary
Parsers()
           
 
Method Summary
static int getLastPage(java.lang.String firstPage)
           
static java.util.Collection parseBandsFromPage(java.lang.String page)
          This method parses the 10 band from a myspace search resultpage
static int[] parseFriendsFromPage(int id, boolean useProxy, java.lang.String proxyHost, java.lang.String proxyPort, CrawlerClient gui)
          parses all friends for a given myspace user id and returns them as int array
static DTO_Profile parseProfileFromPage(int id, boolean useProxy, java.lang.String proxyHost, java.lang.String proxyPort)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parsers

public Parsers()
Method Detail

getLastPage

public static int getLastPage(java.lang.String firstPage)
Parameters:
firstPage - HTML code of the first page of the mySpace music-search
Returns:
the number of the last page in the mySpace music-search,
if a parsing error occurs, -1 is returned

parseBandsFromPage

public static java.util.Collection parseBandsFromPage(java.lang.String page)
This method parses the 10 band from a myspace search resultpage

Parameters:
page - string representation of the html page
Returns:
1. LinkedList of DTO_Bands objects
2. null if there was an error while parsing the page
3. empty LinkedList if all bands got sorted out by the algorithm

parseFriendsFromPage

public static int[] parseFriendsFromPage(int id,
                                         boolean useProxy,
                                         java.lang.String proxyHost,
                                         java.lang.String proxyPort,
                                         CrawlerClient gui)
                                  throws java.net.MalformedURLException,
                                         java.io.IOException
parses all friends for a given myspace user id and returns them as int array

Parameters:
id - the user id who's friendlist should be parsed
useProxy - set to true if you wanna use a proxy, otherwise false
proxyHost - the ip of the proxy server, if userProxy is false u may use null here
proxyPort - the port of the proxy server, if userProxy is false u may use null here
gui - the reference to the CrawlerClient gui, use null if you don't want to use gui output
Returns:
all friends of the given user as a funny int array, sorted ascending
Throws:
java.net.MalformedURLException
java.io.IOException

parseProfileFromPage

public static DTO_Profile parseProfileFromPage(int id,
                                               boolean useProxy,
                                               java.lang.String proxyHost,
                                               java.lang.String proxyPort)
                                        throws java.net.MalformedURLException,
                                               java.io.IOException
Throws:
java.net.MalformedURLException
java.io.IOException