Package net.dona.doip

# Interface OutDoipMessage

All Superinterfaces:
  `AutoCloseable`

All Known Implementing Classes:
  `OutDoipMessageImpl`

public interface OutDoipMessage extends AutoCloseable
A DOIP message to be written as output (for example, a request from the client, or a response from the server). Users must call `close()` when processing is complete.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `OutputStream`
  `getBytesOutputStream()`
  Returns an `OutputStream` that can be used to write to a bytes segment.
  `Writer`
  `getJsonWriter()`
  Returns a `Writer` that can be used to write to a JSON segment.
  `void`
  `writeBytes(byte[] bytes)`
  Writes a bytes segment into the outgoing message.
  `void`
  `writeBytes(InputStream in)`
  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`
  `writeJson(String json)`
  Writes a JSON segment into the outgoing message.

- ## Method Details

  - ### writeJson

    void writeJson(com.google.gson.JsonElement json) throws IOException
    Writes a JSON segment into the outgoing message.
    Parameters:
      `json` - the json to be written
    Throws:
      `IOException`

  - ### writeJson

    void writeJson(String json) throws IOException
    Writes a JSON segment into the outgoing message.
    Parameters:
      `json` - the json to be written
    Throws:
      `IOException`

  - ### writeJson

    void writeJson(byte[] json) throws IOException
    Writes a JSON segment into the outgoing message.
    Parameters:
      `json` - the json to be written
    Throws:
      `IOException`

  - ### getJsonWriter

    Writer getJsonWriter() throws IOException
    Returns a `Writer` that can be used to write to a JSON segment.
    Returns:
      a `Writer` that can be used to write to a JSON
    Throws:
      `IOException` - if a JSON writer cannot be gotten

  - ### writeBytes

    void writeBytes(byte[] bytes) throws IOException
    Writes a bytes segment into the outgoing message.
    Parameters:
      `bytes` - the bytes the be written
    Throws:
      `IOException`

  - ### writeBytes

    void writeBytes(InputStream in) throws IOException
    Writes a bytes segment into the outgoing message.
    Parameters:
      `in` - an input stream from which bytes will be read and written to the outgoing bytes segment
    Throws:
      `IOException`

  - ### getBytesOutputStream

    OutputStream getBytesOutputStream() throws IOException
    Returns an `OutputStream` that can be used to write to a bytes segment.
    Returns:
      an `OutputStream` that can be used to write to a bytes segment
    Throws:
      `IOException`

  - ### close

    void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `IOException`