Package net.dona.doip
Class InDoipSegmentFromJson
- java.lang.Object
-
- net.dona.doip.InDoipSegmentFromJson
-
- All Implemented Interfaces:
InDoipSegment
public class InDoipSegmentFromJson extends java.lang.Object implements InDoipSegment
An implementation ofInDoipSegment
produced from supplied JSON, which is always a JSON segment.
-
-
Constructor Summary
Constructors Constructor Description InDoipSegmentFromJson(com.google.gson.JsonElement json)
Constructs anInDoipSegment
JSON segment from the supplied JSON.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStream
getInputStream()
Returns an input stream, for either a JSON segment or a bytes segment.com.google.gson.JsonElement
getJson()
Returns the JSON of a JSON segmentboolean
isJson()
Returns true if this is a JSON segment, false if this is a bytes segment.
-
-
-
Constructor Detail
-
InDoipSegmentFromJson
public InDoipSegmentFromJson(com.google.gson.JsonElement json)
Constructs anInDoipSegment
JSON segment from the supplied JSON.- Parameters:
json
- the JSON for the JSON segment
-
-
Method Detail
-
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
public java.io.InputStream 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
public com.google.gson.JsonElement 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
-
-