Package org.custommonkey.xmlunit
Class DoctypeReader
- java.lang.Object
-
- java.io.Reader
-
- org.custommonkey.xmlunit.DoctypeReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
public class DoctypeReader extends Reader
Adapts the marked-up content in a source Reader to specify that it conforms to a different DTD. Combines Reader semantics with the ability to specify a target doctype for a character stream containing XML markup. Used by Validator class to wrap a Reader when performing validation of a document against a DTD.
-
-
Constructor Summary
Constructors Constructor Description DoctypeReader(Reader originalSource, String doctypeName, String systemID)Create a Reader whose XML content is provided by the originalSource with the exception of the DOCTYPE which is provided by the doctypeName and systemID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected StringgetContent()intread()Read DOCTYPE-replaced content from the wrapped Readerintread(char[] cbuf, int off, int len)Read DOCTYPE-replaced content from the wrapped Reader-
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
DoctypeReader
public DoctypeReader(Reader originalSource, String doctypeName, String systemID)
Create a Reader whose XML content is provided by the originalSource with the exception of the DOCTYPE which is provided by the doctypeName and systemID.- Parameters:
originalSource- the original inputdoctypeName- name of the new doctypesystemID- system id of the new doctype
-
-
Method Detail
-
getContent
protected String getContent() throws IOException
- Returns:
- the content of the original source, without amendments or substitutions. Safe to call multiple times.
- Throws:
IOException- if thrown while reading from the original source
-
read
public int read(char[] cbuf, int off, int len) throws IOExceptionRead DOCTYPE-replaced content from the wrapped Reader- Specified by:
readin classReader- Throws:
IOException
-
read
public int read() throws IOExceptionRead DOCTYPE-replaced content from the wrapped Reader- Overrides:
readin classReader- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
-