Package net.dona.doip
Class InDoipSegmentFromInputStream
java.lang.Object
net.dona.doip.InDoipSegmentFromInputStream
- All Implemented Interfaces:
InDoipSegment
An implementation of
InDoipSegment
produced from in input stream; may be either a JSON segment or a bytes segment.-
Constructor Summary
ConstructorsConstructorDescriptionInDoipSegmentFromInputStream
(boolean isJson, InputStream in) Constructs anInDoipSegment
from an input stream. -
Method Summary
-
Constructor Details
-
InDoipSegmentFromInputStream
Constructs anInDoipSegment
from an input stream.- Parameters:
isJson
- whether this will be a JSON segmentin
- an input stream supplying the bytes of the segment
-
-
Method Details
-
isJson
public boolean isJson()Description copied from interface:InDoipSegment
Returns true if this is a JSON segment, false if this is a bytes segment.- Specified by:
isJson
in interfaceInDoipSegment
- Returns:
- true if this is a JSON segment, otherwise false
-
getInputStream
Description copied from interface:InDoipSegment
Returns an input stream, for either a JSON segment or a bytes segment.- Specified by:
getInputStream
in interfaceInDoipSegment
- Returns:
- an input stream containing the bytes from the segment (including a serialization of a JSON segment)
-
getJson
Description copied from interface:InDoipSegment
Returns the JSON of a JSON segment- Specified by:
getJson
in interfaceInDoipSegment
- Returns:
- the JSON of a JSON segment
- Throws:
IOException
- if there is a JSON parsing error
-