Class PomProjectInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.owasp.dependencycheck.xml.pom.PomProjectInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
Filters everything in an input stream prior to the <project> element.
This is useful to filter out the DOCTYPE declarations that can cause parsing
issues.
- Author:
- Jeremy Long
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe size of the buffer used to scan the input stream.Fields inherited from class FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new POM project filtering input stream. -
Method Summary
Modifier and TypeMethodDescriptionprotected static intfindSequence(byte[] sequence, byte[] buffer) Finds the start of the given sequence in the buffer.Methods inherited from class FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skipMethods inherited from class InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
Field Details
-
BUFFER_SIZE
protected static final int BUFFER_SIZEThe size of the buffer used to scan the input stream.- See Also:
-
-
Constructor Details
-
PomProjectInputStream
Constructs a new POM project filtering input stream. The input stream is wrapped in a buffered input stream.- Parameters:
in- the input stream- Throws:
IOException- thrown if there is an I/O error
-
-
Method Details
-
findSequence
protected static int findSequence(byte[] sequence, byte[] buffer) Finds the start of the given sequence in the buffer. If not found, -1 is returned.- Parameters:
sequence- the sequence to locatebuffer- the buffer to search- Returns:
- the starting position of the sequence in the buffer if found; otherwise -1
-