20 package net.sf.gridarta.utils.xml;
22 import java.io.ByteArrayInputStream;
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.nio.charset.StandardCharsets;
26 import org.jetbrains.annotations.NotNull;
27 import org.jetbrains.annotations.Nullable;
73 public FixedDtdInputStream(@NotNull
final InputStream inputStream, @NotNull
final String rootElement, @NotNull
final String systemId) {
80 public int read() throws IOException {
82 final int ch = inject.read();
89 final int ch = inputStream.read();
105 }
else if (ch ==
'!') {
108 final String doctypeDeclaration =
"DOCTYPE " + rootElement +
" SYSTEM \"" + systemId +
"\"><" + (char) ch;
109 inject =
new ByteArrayInputStream(doctypeDeclaration.getBytes(StandardCharsets.US_ASCII));
124 }
else if (ch !=
'?') {