edu.harvard.hul.ois.jhove.module.xml
Class XmlDeclStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by edu.harvard.hul.ois.jhove.module.xml.XmlDeclStream
All Implemented Interfaces:
java.io.Closeable

public class XmlDeclStream
extends java.io.FilterInputStream

This class is layered under the InputSource for the XmlModule so that it can detect an XML declaration and character references, which aren't reported by other API's. This is called XmlDeclStream for historical reasons, though it's no longer limited to that function.

Author:
Gary McGath

Field Summary
protected  boolean _lineEndCR
           
protected  boolean _lineEndCRLF
           
protected  boolean _lineEndLF
           
protected  int _prevChar
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
XmlDeclStream(java.io.InputStream strm)
           
 
Method Summary
protected  void checkLineEnd(int ch)
           
 java.util.List<java.lang.Integer> getCharacterReferences()
          Returns the character references as a List of Integers.
 java.lang.String getEncoding()
          Returns the encoding string.
 java.lang.String getKindOfLineEnd()
           
 java.lang.String getStandalone()
          Returns the standalone string.
 java.lang.String getVersion()
          Returns the version string.
 int read()
          Reads the next byte of data from this input stream.
 int read(byte[] b)
          Reads up to byte.length bytes of data from this input stream into an array of bytes.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this input stream into an array of bytes.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_lineEndCR

protected boolean _lineEndCR

_lineEndLF

protected boolean _lineEndLF

_lineEndCRLF

protected boolean _lineEndCRLF

_prevChar

protected int _prevChar
Constructor Detail

XmlDeclStream

public XmlDeclStream(java.io.InputStream strm)
Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of data from this input stream. Processes bytes as it reads them.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Reads up to byte.length bytes of data from this input stream into an array of bytes. Processes bytes as it reads them.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes of data from this input stream into an array of bytes. Processes bytes as it reads them.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

getCharacterReferences

public java.util.List<java.lang.Integer> getCharacterReferences()
Returns the character references as a List of Integers. No sorting or elimination of duplicates is done; this is just all the character references in the order they occurred.


getVersion

public java.lang.String getVersion()
Returns the version string. May be null (though it shouldn't be in well-formed XML).


getEncoding

public java.lang.String getEncoding()
Returns the encoding string. May be null.


getStandalone

public java.lang.String getStandalone()
Returns the standalone string. May be null.


checkLineEnd

protected void checkLineEnd(int ch)

getKindOfLineEnd

public java.lang.String getKindOfLineEnd()