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 anOutDoipMessagewhich will write a serialized DOIP message into the suppliedOutputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidCloses the particular segment currently being written, if anyReturns anOutputStreamthat can be used to write to a bytes segment.Returns aWriterthat can be used to write to a JSON segment.voidwriteBytes(byte[] bytes) Writes a bytes segment into the outgoing message.voidWrites a bytes segment into the outgoing message.voidwriteJson(byte[] json) Writes a JSON segment into the outgoing message.voidwriteJson(com.google.gson.JsonElement json) Writes a JSON segment into the outgoing message.voidWrites a JSON segment into the outgoing message.
-
Constructor Details
-
OutDoipMessageImpl
Constructs anOutDoipMessagewhich 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:OutDoipMessageWrites a JSON segment into the outgoing message.- Specified by:
writeJsonin interfaceOutDoipMessage- Parameters:
json- the json to be written- Throws:
IOException
-
writeJson
Description copied from interface:OutDoipMessageWrites a JSON segment into the outgoing message.- Specified by:
writeJsonin interfaceOutDoipMessage- Parameters:
json- the json to be written- Throws:
IOException
-
writeJson
Description copied from interface:OutDoipMessageWrites a JSON segment into the outgoing message.- Specified by:
writeJsonin interfaceOutDoipMessage- Parameters:
json- the json to be written- Throws:
IOException
-
getJsonWriter
Description copied from interface:OutDoipMessageReturns aWriterthat can be used to write to a JSON segment.- Specified by:
getJsonWriterin interfaceOutDoipMessage- Returns:
- a
Writerthat can be used to write to a JSON
-
writeBytes
Description copied from interface:OutDoipMessageWrites a bytes segment into the outgoing message.- Specified by:
writeBytesin interfaceOutDoipMessage- Parameters:
bytes- the bytes the be written- Throws:
IOException
-
writeBytes
Description copied from interface:OutDoipMessageWrites a bytes segment into the outgoing message.- Specified by:
writeBytesin 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:OutDoipMessageReturns anOutputStreamthat can be used to write to a bytes segment.- Specified by:
getBytesOutputStreamin interfaceOutDoipMessage- Returns:
- an
OutputStreamthat 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceOutDoipMessage- Throws:
IOException
-