net.sf.uadetector.datareader
Class XmlDataReader
java.lang.Object
net.sf.uadetector.datareader.XmlDataReader
- All Implemented Interfaces:
- DataReader
public final class XmlDataReader
- extends java.lang.Object
- implements DataReader
Reader for the XML data for UASparser from http://user-agent-string.info.
This reader is safe when used concurrently by multiple threads.
- Author:
- André Rouél
|
Method Summary |
Data |
read(java.lang.String data)
Reads the UAS data in XML format from the given string. |
Data |
read(java.net.URL url,
java.nio.charset.Charset charset)
Reads the UAS data in XML format based on the given URL. |
protected static Data |
readXml(java.io.InputStream inputStream,
java.nio.charset.Charset charset)
Reads the UAS data in XML format based on the given URL. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlDataReader
public XmlDataReader()
readXml
protected static Data readXml(@Nonnull
java.io.InputStream inputStream,
@Nonnull
java.nio.charset.Charset charset)
- Reads the UAS data in XML format based on the given URL.
When during the reading errors occur which lead to a termination of the read operation, the information will be
written to a log. The termination of the read operation will not lead to a program termination and in this case
this method returns Data.EMPTY.
- Parameters:
inputStream - an input stream for reading UAS datacharset - the character set in which the data should be read
- Returns:
- read in UAS data as
Data instance
- Throws:
net.sf.qualitycheck.exception.IllegalNullArgumentException - if any of the given arguments is null
CanNotOpenStreamException - if no stream to the given URL can be established
read
public Data read(@Nonnull
java.lang.String data)
- Reads the UAS data in XML format from the given string.
- Specified by:
read in interface DataReader
- Parameters:
data - UAS data as string
- Returns:
- read in User-Agent data as
Data instance otherwise Data.EMPTY
- Throws:
net.sf.qualitycheck.exception.IllegalNullArgumentException - if any of the given argument is null
read
public Data read(@Nonnull
java.net.URL url,
@Nonnull
java.nio.charset.Charset charset)
- Reads the UAS data in XML format based on the given URL.
- Specified by:
read in interface DataReader
- Parameters:
url - URL to User-Agent informationscharset - the character set in which the data should be read
- Returns:
- read in User-Agent data as
Data instance otherwise Data.EMPTY
- Throws:
net.sf.qualitycheck.exception.IllegalNullArgumentException - if any of the given arguments is null
Copyright © 2011-2014. All Rights Reserved.