edu.internet2.middleware.grouperClientExt.com.thoughtworks.xstream.core.util
Class XmlHeaderAwareReader

java.lang.Object
  extended by java.io.Reader
      extended by edu.internet2.middleware.grouperClientExt.com.thoughtworks.xstream.core.util.XmlHeaderAwareReader
All Implemented Interfaces:
Closeable, Readable

public final class XmlHeaderAwareReader
extends Reader

A Reader that evaluates the XML header. It selects its encoding based on the encoding read with the XML header of the provided InputStream. The default encoding is UTF-8 and the version is 1.0 if the stream does not contain an XML header or the attributes are not set within the header.

Since:
1.3
Author:
Jörg Schaible

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
XmlHeaderAwareReader(InputStream in)
          Constructs an XmlHeaderAwareReader.
 
Method Summary
 void close()
           
 boolean equals(Object obj)
           
 String getEncoding()
           
 double getVersion()
           
 int hashCode()
           
 void mark(int readAheadLimit)
           
 boolean markSupported()
           
 int read()
           
 int read(char[] cbuf)
           
 int read(char[] cbuf, int offset, int length)
           
 boolean ready()
           
 void reset()
           
 long skip(long n)
           
 String toString()
           
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XmlHeaderAwareReader

public XmlHeaderAwareReader(InputStream in)
                     throws UnsupportedEncodingException,
                            IOException
Constructs an XmlHeaderAwareReader.

Parameters:
in - the InputStream
Throws:
UnsupportedEncodingException - if the encoding is not supported
IOException - occurred while reading the XML header
Since:
1.3
Method Detail

getEncoding

public String getEncoding()
Since:
1.3
See Also:
InputStreamReader.getEncoding()

getVersion

public double getVersion()
Since:
1.3
See Also:
InputStreamReader.getEncoding()

mark

public void mark(int readAheadLimit)
          throws IOException
Overrides:
mark in class Reader
Throws:
IOException
See Also:
Reader.mark(int)

markSupported

public boolean markSupported()
Overrides:
markSupported in class Reader
See Also:
Reader.markSupported()

read

public int read()
         throws IOException
Overrides:
read in class Reader
Throws:
IOException
See Also:
Reader.read()

read

public int read(char[] cbuf,
                int offset,
                int length)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException
See Also:
Reader.read(char[], int, int)

read

public int read(char[] cbuf)
         throws IOException
Overrides:
read in class Reader
Throws:
IOException
See Also:
Reader.read(char[])

ready

public boolean ready()
              throws IOException
Overrides:
ready in class Reader
Throws:
IOException
See Also:
Reader.ready()

reset

public void reset()
           throws IOException
Overrides:
reset in class Reader
Throws:
IOException
See Also:
Reader.reset()

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class Reader
Throws:
IOException
See Also:
Reader.skip(long)

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Reader
Throws:
IOException
See Also:
Reader.close()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2012 Internet2. All Rights Reserved.