Object
A utility which can pull META tags from an HTML file.
This will also pull the title of an HTML from the <title></title> section anywhere in the document. No matter what the casing of the title tag, it will be put in the metadata properties as "title".
Object
MetaParser
Method Summary |
public static final |
|
public static final |
|
public static |
|
public static |
|
public static |
|
public static final |
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static finalTry to determine the encoding from a <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=" > instruction.String
determineEncoding(File
f,String
encoding)
throwsIOException
If an encoding is passed in and the files doesn't contain an appropriate META tag, that encoding will be returned.
IOException
public static finalTry to determine the encoding from a <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=" > instruction.String
determineEncoding(BufferedReader
reader)
throwsIOException
IOException
public staticLoad the META tag name/value pairs from f into p.Properties
load(File
f,Properties
p)
throwsIOException
IOException
public staticLoad the META tag name/value pairs from f into p.Properties
load(File
f,Properties
p,String
enc)
throwsIOException
This will look for the encoding name to use by trying to find a <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=" > tag in the HTML (this will use the passed in encoding to find the encoding). If a valid encoding name is found, the file will be opened with that encoding, and the "encoding" property in the Properties will be set. If a valid encoding is not found and an encoding was passed in, that encoding will be used. If an encoding was not passed in, the system default will be used.
IOException
public staticLoad the META tag name/value pairs from the input stream into p.Properties
load(BufferedReader
reader,Properties
p)
throwsIOException
This operates on a last-seen-is-returned alogirithm for META tags with the same name. It will also find all meta tags in file, not just those in the head.
IOException
public static finalOpen a file with the given encoding.BufferedReader
open(File
f,String
encoding)
throwsIOException
IOException