Email Answering System
Version 1.0

com.ninecode.email.util
Class WebBean

java.lang.Object
  |
  +--com.ninecode.email.util.WebBean
Direct Known Subclasses:
StockBean, WeatherBean

public class WebBean
extends Object

Fetches a web page and turns it into text.

Author:
Derrick Oswald

Field Summary
protected static int mBufferSize
           
protected  String mUrl
           
static String newline
           
static int newline_size
           
 
Constructor Summary
WebBean()
          Creates a new instance of WebBean
 
Method Summary
protected  void carriage_return(StringBuffer buffer)
          Appends a newline to the buffer if there isn't one there already.
protected  void collapse(StringBuffer buffer, String string)
          Add the given text collapsing whitespace.
 String getContent()
           
 String getContent(boolean links)
           
protected  String getContent(org.htmlparser.HTMLParser parser, boolean links)
           
 String getURL()
           
 void setURL(String url)
           
 String toString()
          Generate a string representing the state of this bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mUrl

protected String mUrl

newline

public static final String newline

newline_size

public static final int newline_size

mBufferSize

protected static final int mBufferSize
See Also:
Constant Field Values
Constructor Detail

WebBean

public WebBean()
Creates a new instance of WebBean

Method Detail

setURL

public void setURL(String url)

getURL

public String getURL()

getContent

public String getContent()

carriage_return

protected void carriage_return(StringBuffer buffer)
Appends a newline to the buffer if there isn't one there already. Except if the buffer is empty

Parameters:
buffer - The buffer to append to.

collapse

protected void collapse(StringBuffer buffer,
                        String string)
Add the given text collapsing whitespace. Use a little finite state machine:
 state 0: whitepace was last emitted character
 state 1: in whitespace
 state 2: in word
 A whitespace character moves us to state 1 and any other character
 moves us to state 2, except that state 0 stays in state 0 until
 a non-whitespace and going from whitespace to word we emit a space
 before the character:
    input:     whitespace   other-character
 state\next
    0               0             2
    1               1        space then 2
    2               1             2
 

Parameters:
buffer - The buffer to append to.
string - The string to append.

getContent

public String getContent(boolean links)

getContent

protected String getContent(org.htmlparser.HTMLParser parser,
                            boolean links)

toString

public String toString()
Generate a string representing the state of this bean.

Overrides:
toString in class Object
Returns:
A string of the form:
 http://www.cbc.ca
 

Email Answering System
Version 1.0

Copyright © 2003 Derrick Oswald. All rights reserved.