Class JsonArrayFixingInputStream
java.lang.Object
java.io.InputStream
org.owasp.dependencycheck.utils.JsonArrayFixingInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
Fixes a poorly formatted jSON array such as those returned by
go list -json -m all.
Example:
{ "name1": "value" }
{ "name2" : "value" }
Would be transformed into:
[{ "name1": "value" },
{ "name2" : "value" }]
Note that this is a naive implementation and will incorrectly transform a stream if there are '}' contained within the names of values.
- Author:
- Jeremy Long
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new filtering input stream used to fix a poorly formatted JSON array. -
Method Summary
Methods inherited from class InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
Constructor Details
-
JsonArrayFixingInputStream
Constructs a new filtering input stream used to fix a poorly formatted JSON array.- Parameters:
in- the InputStream containing the poorly formed JSON array
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
isWhiteSpace
protected boolean isWhiteSpace(byte c) Tests if the byte passed in is a white space character.- Parameters:
c- the byte representing the character to test- Returns:
trueif the byte is white space; otherwisefalse
-