Package org.gvsig.utils.xml
Class XMLEncodingUtils
java.lang.Object
org.gvsig.utils.xml.XMLEncodingUtils
A set of methods to detect XML encoding. The class is able to autodetect
certain encodings, and it reads the XML header for the rest of encodings.
- Author:
- César Martínez Izquierdo invalid input: '<'cesar.martinez@iver.es>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the encoding of the XML file.static StringgetEncoding(File file) Gets the character encoding of the XML file.static StringGets the character encoding of the XML file.Gets an InputStreamReader for the provided XML file.static InputStreamReaderGets an InputStreamReader for the provided XML file.static InputStreamReadergetReader(InputStream is) Gets an InputStreamReader for the provided XML file.
-
Constructor Details
-
XMLEncodingUtils
Creates a new XMLEncodingUtils object.- Parameters:
is- An InputStream connected to the XML file to process.
-
-
Method Details
-
getEncoding
Gets the encoding of the XML file. The following encodings can be detected: UTF-32BE, UTF-32LE, UTF-16BE, UTF-16-LE, UTF-8. The rest of the encodings are read from the XML header.- Returns:
- Returns the encoding of the XML file, or null if the encoding couldn't be correctly detected or read from the XML header.
-
getReader
Gets an InputStreamReader for the provided XML file. The reader uses the right encoding, as specified in the XML header (or autodetected).- Returns:
- A reader which uses the right encoding, or null if the encoding couldn't be correctly detected or read from the XML header.
-
getReader
Gets an InputStreamReader for the provided XML file. The reader uses the right encoding, as specified in the XML header (or autodetected).- Parameters:
is- An InputStream connected to the XML file to process- Returns:
- A reader for the provided XML file.
- See Also:
-
getEncoding
Gets the character encoding of the XML file.- Parameters:
is- An InputStream connected to the XML file to process- Returns:
- The encoding of the file
- See Also:
-
getReader
Gets an InputStreamReader for the provided XML file. The reader uses the right encoding, as specified in the XML header (or autodetected).- Parameters:
file- The XML file to process- Returns:
- A reader for the provided XML file.
- Throws:
FileNotFoundException- See Also:
-
getEncoding
Gets the character encoding of the XML file.- Parameters:
File- The XML file to process- Returns:
- The encoding of the file
- Throws:
FileNotFoundException- See Also:
-