Package net.dona.doip
Class OutDoipMessageImpl
java.lang.Object
net.dona.doip.OutDoipMessageImpl
- All Implemented Interfaces:
AutoCloseable
,OutDoipMessage
An implementation of
OutDoipMessage
which writes a serialized DOIP message into an OutputStream
.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anOutDoipMessage
which will write a serialized DOIP message into the suppliedOutputStream
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Closes the particular segment currently being written, if anyReturns anOutputStream
that can be used to write to a bytes segment.Returns aWriter
that can be used to write to a JSON segment.void
writeBytes
(byte[] bytes) Writes a bytes segment into the outgoing message.void
Writes a bytes segment into the outgoing message.void
writeJson
(byte[] json) Writes a JSON segment into the outgoing message.void
writeJson
(com.google.gson.JsonElement json) Writes a JSON segment into the outgoing message.void
Writes a JSON segment into the outgoing message.
-
Constructor Details
-
OutDoipMessageImpl
Constructs anOutDoipMessage
which will write a serialized DOIP message into the suppliedOutputStream
.- Parameters:
out
- the stream into which to write the serialized DOIP message
-
-
Method Details
-
writeJson
Description copied from interface:OutDoipMessage
Writes a JSON segment into the outgoing message.- Specified by:
writeJson
in interfaceOutDoipMessage
- Parameters:
json
- the json to be written- Throws:
IOException
-
writeJson
Description copied from interface:OutDoipMessage
Writes a JSON segment into the outgoing message.- Specified by:
writeJson
in interfaceOutDoipMessage
- Parameters:
json
- the json to be written- Throws:
IOException
-
writeJson
Description copied from interface:OutDoipMessage
Writes a JSON segment into the outgoing message.- Specified by:
writeJson
in interfaceOutDoipMessage
- Parameters:
json
- the json to be written- Throws:
IOException
-
getJsonWriter
Description copied from interface:OutDoipMessage
Returns aWriter
that can be used to write to a JSON segment.- Specified by:
getJsonWriter
in interfaceOutDoipMessage
- Returns:
- a
Writer
that can be used to write to a JSON
-
writeBytes
Description copied from interface:OutDoipMessage
Writes a bytes segment into the outgoing message.- Specified by:
writeBytes
in interfaceOutDoipMessage
- Parameters:
bytes
- the bytes the be written- Throws:
IOException
-
writeBytes
Description copied from interface:OutDoipMessage
Writes a bytes segment into the outgoing message.- Specified by:
writeBytes
in interfaceOutDoipMessage
- Parameters:
in
- an input stream from which bytes will be read and written to the outgoing bytes segment- Throws:
IOException
-
getBytesOutputStream
Description copied from interface:OutDoipMessage
Returns anOutputStream
that can be used to write to a bytes segment.- Specified by:
getBytesOutputStream
in interfaceOutDoipMessage
- Returns:
- an
OutputStream
that can be used to write to a bytes segment - Throws:
IOException
-
closeSegmentOutput
Closes the particular segment currently being written, if any- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceOutDoipMessage
- Throws:
IOException
-