com.bluecast.xml

Class XMLStreamReader


public final class XMLStreamReader
extends XMLInputReader

A Reader for XML documents and streams. This class automatically determines the proper character set to use based on Byte Order Marks and XML declarations.
Version:
$Revision: 1.7 $
Author:
Yuval Oren, yuval@bluecast.com

Constructor Summary

XMLStreamReader()
Create an XMLStreamReader without providing an InputStream yet.
XMLStreamReader(InputStream in, String encoding, boolean rewindDeclaration)
Creates an XMLStreamReader while specifying a character encoding.
XMLStreamReader(InputStream in, boolean rewindDeclaration)
Creates an XMLStreamReader.

Method Summary

void
close()
String
getEncoding()
Returns the character set being used by the reader.
void
mark(int readAheadLimit)
boolean
markSupported()
int
read()
int
read(char[] destbuf)
int
read(char[] destbuf, int off, int len)
boolean
ready()
void
reset()
void
reset(InputStream in, String encoding, boolean rewindDeclaration)
Reuses this XMLStreamReader for a different InputStream.
long
skip(long n)

Methods inherited from class com.bluecast.xml.XMLInputReader

getXMLDeclaredEncoding, getXMLVersion, isXMLStandalone, isXMLStandaloneDeclared, parseXMLDeclaration, resetInput

Constructor Details

XMLStreamReader

public XMLStreamReader()
Create an XMLStreamReader without providing an InputStream yet. You must call reset() before using.

XMLStreamReader

public XMLStreamReader(InputStream in,
                       String encoding,
                       boolean rewindDeclaration)
            throws IOException
Creates an XMLStreamReader while specifying a character encoding.

XMLStreamReader

public XMLStreamReader(InputStream in,
                       boolean rewindDeclaration)
            throws IOException
Creates an XMLStreamReader.
Parameters:
in - the InputStream
rewindDeclaration - a value of false will skip past any XML declaration. True will dish out the entire document.

Method Details

close

public void close()
            throws IOException

getEncoding

public String getEncoding()
Returns the character set being used by the reader. Note that the encoding in the XML declaration is ignored if it is not needed to determine the character set.

mark

public void mark(int readAheadLimit)
            throws IOException

markSupported

public boolean markSupported()

read

public int read()
            throws IOException

read

public int read(char[] destbuf)
            throws IOException

read

public int read(char[] destbuf,
                int off,
                int len)
            throws IOException

ready

public boolean ready()
            throws IOException

reset

public void reset()
            throws IOException

reset

public void reset(InputStream in,
                  String encoding,
                  boolean rewindDeclaration)
            throws IOException
Reuses this XMLStreamReader for a different InputStream.

skip

public long skip(long n)
            throws IOException