public class DocTypeDeclRemover
extends BufferedInputStream
Modifier and Type | Field and Description |
---|---|
private static int |
BLOCK_SIZE
How many bytes to scan before giving up
|
private boolean |
firstTime
Marks whether we've scanned the initial block for a DOCTYPE decl
|
Constructor and Description |
---|
DocTypeDeclRemover(InputStream in)
Default constructor: records the input stream to filter.
|
Modifier and Type | Method and Description |
---|---|
private int |
findEnd(String s,
int start) |
int |
read()
See
the general contract of the
read
method of InputStream . |
int |
read(byte[] b,
int off,
int len)
Read a block of bytes.
|
private boolean firstTime
private static final int BLOCK_SIZE
public DocTypeDeclRemover(InputStream in)
public int read() throws IOException
read
method of InputStream
.read
in class BufferedInputStream
-1
if the end of the
stream is reached.IOException
- if an I/O error occurs.FilterInputStream.in
public int read(byte[] b, int off, int len) throws IOException
BLOCK_SIZE
bytes will be
scanned for a DOCTYPE declaration, and if one is found it will be
converted to an XML comment.read
in class BufferedInputStream
b
- Buffer to read intooff
- Byte offset to read intolen
- Number of bytes to read-1
if the end of
the stream has been reached.IOException
- if an I/O error occurs.private int findEnd(String s, int start)