public class HTMLFilter extends java.lang.Object implements ContentDataFilter, CharsetExtractor
Modifier and Type | Class and Description |
---|---|
static class |
HTMLFilter.ParsedTag |
CharsetExtractor.BOMDetection
Modifier and Type | Field and Description |
---|---|
static boolean |
embedM3uPlayer
if true, embed m3u player.
|
static int |
metaRefreshRedirectMinInterval
-1 means don't allow it
|
static int |
metaRefreshSamePageMinInterval
-1 means don't allow it
|
Constructor and Description |
---|
HTMLFilter() |
Modifier and Type | Method and Description |
---|---|
static java.util.Set<java.lang.String> |
getAllowedHTMLTags() |
java.lang.String |
getCharset(byte[] input,
int length,
java.lang.String parseCharset) |
int |
getCharsetBufferSize()
How many bytes must be fed into the CharsetExtractor to figure
out the charset
|
CharsetExtractor.BOMDetection |
getCharsetByBOM(byte[] input,
int length)
Inspect the first few bytes of the file for any obvious but
type-specific BOM.
|
void |
readFilter(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String charset,
java.util.Map<java.lang.String,java.lang.String> otherParams,
java.lang.String schemeHostAndPort,
FilterCallback cb)
Filter data for reading.
|
static java.lang.String[] |
splitType(java.lang.String type) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readFilter
public static boolean embedM3uPlayer
public static int metaRefreshSamePageMinInterval
public static int metaRefreshRedirectMinInterval
public void readFilter(java.io.InputStream input, java.io.OutputStream output, java.lang.String charset, java.util.Map<java.lang.String,java.lang.String> otherParams, java.lang.String schemeHostAndPort, FilterCallback cb) throws DataFilterException, java.io.IOException
ContentDataFilter
readFilter
in interface ContentDataFilter
input
- Stream to read potentially unsafe data from.output
- Stream to write safe (but possibly incomplete) data to.charset
- Character set of the data if appropriate for this MIME type.otherParams
- Other type parameters if appropriate.schemeHostAndPort
- Scheme, host and port of the node as seen in the request.cb
- Filter callback for modifying HTML tags. Irrelevant for most MIME types. In future we
might need this for other types.DataFilterException
- If the data cannot be filtered. Any data
written so far should be discarded if possible.java.io.IOException
- If there was a failure to read from the input data
or write to the output data. Implementations should not throw this
if data is merely badly formatted - any such exceptions should be
caught and converted to a DataFilterException.public java.lang.String getCharset(byte[] input, int length, java.lang.String parseCharset) throws DataFilterException, java.io.IOException
getCharset
in interface CharsetExtractor
DataFilterException
java.io.IOException
public static java.util.Set<java.lang.String> getAllowedHTMLTags()
public static java.lang.String[] splitType(java.lang.String type)
public CharsetExtractor.BOMDetection getCharsetByBOM(byte[] input, int length) throws DataFilterException
CharsetExtractor
getCharsetByBOM
in interface CharsetExtractor
input
- The data.DataFilterException
public int getCharsetBufferSize()
CharsetExtractor
getCharsetBufferSize
in interface CharsetExtractor