soapical.util
Class XMLInputStreamReader

java.lang.Object
  extended byjava.io.Reader
      extended bysoapical.util.XMLInputStreamReader

public class XMLInputStreamReader
extends java.io.Reader

This serves the same purpose as java.io.InputStreamReader except that it assumes that the InputStream contains XML and tries to automatically detect the encoding.

Version:
$Revision: 1.1 $
$Date: 2003/08/01 14:44:12 $
Author:
Eric Kow (kow at loria point fr)

Constructor Summary
XMLInputStreamReader(java.io.InputStream is)
           
 
Method Summary
 void close()
           
static java.lang.String detectEncoding(java.lang.String prolog)
          Detects the character set encoding mentioned in the input string.
static boolean hasXMLDecl(java.lang.String prolog)
          Returns true if the input has an XML declaration.
 int read(char[] buf, int off, int len)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLInputStreamReader

public XMLInputStreamReader(java.io.InputStream is)
                     throws java.io.UnsupportedEncodingException,
                            java.io.IOException
Method Detail

detectEncoding

public static java.lang.String detectEncoding(java.lang.String prolog)
Detects the character set encoding mentioned in the input string. Helper function for #detectEncoding(InputStream).

Parameters:
prolog - an XML declaration like <?xml version="1.0" encoding="ISO-8859-1"?>).
Returns:
an IANA encoding name or null if one cannot be determined.

hasXMLDecl

public static boolean hasXMLDecl(java.lang.String prolog)
Returns true if the input has an XML declaration.


read

public int read(char[] buf,
                int off,
                int len)
         throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException