org.encog.bot
Class BotUtil
- java.lang.Object
-
- org.encog.bot.BotUtil
-
public final class BotUtil extends java.lang.ObjectUtility class for bots.
-
-
Field Summary
Fields Modifier and Type Field and Description static intBUFFER_SIZEHow much data to read at once.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voiddownloadPage(java.net.URL url, java.io.File file)Load the specified URL to a file.static java.lang.Stringextract(java.lang.String str, java.lang.String token1, java.lang.String token2, int index)This method is very useful for grabbing information from a HTML page.static java.lang.StringextractFromIndex(java.lang.String str, java.lang.String token1, java.lang.String token2, int index, int occurence)This method is very useful for grabbing information from a HTML page.static intfindOccurance(java.lang.String search, java.lang.String searchFor, int index)Find the specified occurrence of one string in another string.static java.lang.StringloadPage(java.io.InputStream is)Load load from the specified input stream.static java.lang.StringloadPage(java.net.URL url)Load the specified web page into a string.static java.lang.StringstripTags(java.lang.String str)Strip any HTML or XML tags from the specified string.
-
-
-
Field Detail
-
BUFFER_SIZE
public static final int BUFFER_SIZE
How much data to read at once.- See Also:
- Constant Field Values
-
-
Method Detail
-
downloadPage
public static void downloadPage(java.net.URL url, java.io.File file)Load the specified URL to a file.- Parameters:
url- The URL.file- The file.
-
extract
public static java.lang.String extract(java.lang.String str, java.lang.String token1, java.lang.String token2, int index)This method is very useful for grabbing information from a HTML page.- Parameters:
str- The string to search.token1- The text, or tag, that comes before the desired texttoken2- The text, or tag, that comes after the desired textindex- Which occurrence of token1 to use, 1 for the first- Returns:
- The contents of the URL that was downloaded.
-
extractFromIndex
public static java.lang.String extractFromIndex(java.lang.String str, java.lang.String token1, java.lang.String token2, int index, int occurence)This method is very useful for grabbing information from a HTML page.- Parameters:
str- The string to search.token1- The text, or tag, that comes before the desired texttoken2- The text, or tag, that comes after the desired textindex- Index in the string to start searching from.occurence- What occurrence.- Returns:
- The contents of the URL that was downloaded.
-
findOccurance
public static int findOccurance(java.lang.String search, java.lang.String searchFor, int index)Find the specified occurrence of one string in another string.- Parameters:
search- The string to search.searchFor- What we are searching for.index- The occurrence to find.- Returns:
- The index of the specified string, or -1 if not found.
-
loadPage
public static java.lang.String loadPage(java.io.InputStream is)
Load load from the specified input stream.- Parameters:
is- The input stream to load from.- Returns:
- The data loaded from the specified input stream.
-
loadPage
public static java.lang.String loadPage(java.net.URL url)
Load the specified web page into a string.- Parameters:
url- The url to load.- Returns:
- The web page as a string.
-
stripTags
public static java.lang.String stripTags(java.lang.String str)
Strip any HTML or XML tags from the specified string.- Parameters:
str- The string to process.- Returns:
- The string without tags.
-
-
DMelt 3.0 © DataMelt by jWork.ORG