Package org.custommonkey.xmlunit
Class DoctypeInputStream
java.lang.Object
java.io.InputStream
org.custommonkey.xmlunit.DoctypeInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Adapts the marked-up content in a source InputStream to specify that it
conforms to a different DTD.
Combines InputStream semantics with the ability to specify a target doctype
for a byte stream containing XML markup.
Used by Validator class to wrap an InputStream, when performing validation of a
document against a DTD.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteArrayOutputStreamprivate final DoctypeSupportprivate final InputStream -
Constructor Summary
ConstructorsConstructorDescriptionDoctypeInputStream(InputStream originalSource, String encoding, String doctypeName, String systemID) Create an InputStream whose XML content is provided by the originalSource with the exception of the DOCTYPE which is provided by the doctypeName and systemID. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected StringgetContent(String encoding) intread()Read DOCTYPE-replaced content from the wrapped InputStreamMethods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
baos
-
wrappedStream
-
support
-
-
Constructor Details
-
DoctypeInputStream
public DoctypeInputStream(InputStream originalSource, String encoding, String doctypeName, String systemID) Create an InputStream whose XML content is provided by the originalSource with the exception of the DOCTYPE which is provided by the doctypeName and systemID.- Parameters:
originalSource-doctypeName-systemID-
-
-
Method Details
-
getContent
- 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
Read DOCTYPE-replaced content from the wrapped InputStream- Specified by:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-