|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tinyjee.maven.dim.spi.UrlFetcher
public class UrlFetcher
Abstracts url fetching, charset handling and caching.
Field Summary | |
---|---|
static int |
MAX_CACHE_SIZE
Defines the max size of the URL content cache. |
static int |
MAX_CACHED_CONTENT_SIZE
Defines the maximum amount of bytes to keep inside URL content cache per cached element. |
Method Summary | |
---|---|
static long |
getLastModified(URL sourceUrl)
Returns the last modification date of the specified url. |
static BufferedReader |
getReadableSource(URL sourceUrl)
Returns the content text stream of the given source URL. |
static BufferedReader |
getReadableSource(URL sourceUrl,
boolean noCache)
Returns the content text stream of the given source URL. |
static InputStream |
getSource(URL sourceUrl,
boolean noCache)
Returns the content stream of the given source URL. |
static Charset |
getSourceCharset(URL sourceUrl)
Returns the charset that is used to decode the content that is referenced by the given URL. |
static boolean |
isModified(URL sourceUrl)
Returns true if the given url was modified between the last read and this call. |
static String |
readerToString(Reader reader,
boolean closeReader)
Utility method that converts the given text stream to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_CACHE_SIZE
public static final int MAX_CACHED_CONTENT_SIZE
Method Detail |
---|
public static InputStream getSource(URL sourceUrl, boolean noCache) throws IOException
sourceUrl
- the source URL to open.noCache
- whether the content shall be cached / retrieved from the cache or not.
IOException
- in case of the IO transfer failed.public static long getLastModified(URL sourceUrl)
sourceUrl
- the url to retrieve the last modified date for.
public static boolean isModified(URL sourceUrl)
sourceUrl
- the source url to check.
public static BufferedReader getReadableSource(URL sourceUrl) throws IOException
sourceUrl
- the source URL to open.
IOException
- in case of the IO transfer failed.public static BufferedReader getReadableSource(URL sourceUrl, boolean noCache) throws IOException
sourceUrl
- the source URL to open.noCache
- whether the content shall be cached / retrieved from the cache or not.
IOException
- in case of the IO transfer failed.public static String readerToString(Reader reader, boolean closeReader) throws IOException
reader
- the reader to convert.closeReader
- whether the reader should be closed after reading.
IOException
- in case of the IO transfer failed.public static Charset getSourceCharset(URL sourceUrl)
sourceUrl
- the url to retrieve the charset for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |