|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwinterwell.jtwitter.InternalUtils
public class InternalUtils
Utility methods used in Twitter. This class is public in case anyone else wants to use these methods. WARNING: they don't really form part of the JTwitter API, and may be changed or reorganised in future versions.
NB: Some of these are copies (sometimes simplified) of methods in winterwell.utils.Utils
| Field Summary | |
|---|---|
static java.util.regex.Pattern |
latLongLocn
Matches latitude, longitude, including with the UberTwitter UT: prefix Group 2 = latitude, Group 3 = longitude. |
static java.util.regex.Pattern |
pComment
Matches an xml comment - including some bad versions |
static java.util.regex.Pattern |
pDocType
Matches a doctype element. |
static java.util.regex.Pattern |
pScriptOrStyle
Used in strip tags to get rid of scripts and css style blocks altogether. |
static java.util.regex.Pattern |
REGEX_JUST_DIGITS
|
static java.util.regex.Pattern |
TAG_REGEX
|
| Constructor Summary | |
|---|---|
InternalUtils()
|
|
| Method Summary | |
|---|---|
static java.util.Map |
asMap(java.lang.Object... keyValuePairs)
Create a map from a list of key, value pairs. |
static void |
close(java.io.Closeable strm)
|
static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Long> |
getAPIUsageStats()
|
static java.util.Date |
getDate(int year,
java.lang.String month,
int day)
Convenience method for making Dates. |
static java.lang.String |
join(java.lang.String[] screenNames)
Join the list |
protected static java.lang.String |
jsonGet(java.lang.String key,
winterwell.json.JSONObject jsonObj)
Helper method to deal with JSON-in-Java weirdness |
static void |
setTrackAPIUsage(boolean on)
|
static java.lang.String |
stripTags(java.lang.String xml)
Remove xml and html tags, e.g. |
static java.lang.String |
stripUrls(java.lang.String text)
|
protected static java.lang.String |
toString(java.io.InputStream inputStream)
Use a bufferred reader (preferably UTF-8) to extract the contents of the given stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.util.regex.Pattern TAG_REGEX
public static final java.util.regex.Pattern latLongLocn
Weird: I saw this as an address - "ÜT: 25.324488,55.376224t" Is it just a one-off typo? Should we match N/S/E/W markers?
public static final java.util.regex.Pattern REGEX_JUST_DIGITS
public static final java.util.regex.Pattern pComment
public static final java.util.regex.Pattern pScriptOrStyle
public static final java.util.regex.Pattern pDocType
| Constructor Detail |
|---|
public InternalUtils()
| Method Detail |
|---|
public static java.lang.String stripUrls(java.lang.String text)
public static java.util.Map asMap(java.lang.Object... keyValuePairs)
Arrays.asList(Object...). If
the value is null, the key will not be included.
public static void close(java.io.Closeable strm)
public static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Long> getAPIUsageStats()
setTrackAPIUsage(boolean)
public static java.util.Date getDate(int year,
java.lang.String month,
int day)
year - month - day -
public static java.lang.String join(java.lang.String[] screenNames)
screenNames -
protected static java.lang.String jsonGet(java.lang.String key,
winterwell.json.JSONObject jsonObj)
public static void setTrackAPIUsage(boolean on)
on - true to activate getAPIUsageStats(). false to switch
stats off. false by defaultprotected static java.lang.String toString(java.io.InputStream inputStream)
toString(Reader).
public static java.lang.String stripTags(java.lang.String xml)
xml - can be null, in which case null will be returned
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||