Package net.dona.doip

Interface OutDoipMessage

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    OutDoipMessageImpl

    public interface OutDoipMessage
    extends java.lang.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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()  
      java.io.OutputStream getBytesOutputStream()
      Returns an OutputStream that can be used to write to a bytes segment.
      java.io.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​(java.io.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​(java.lang.String json)
      Writes a JSON segment into the outgoing message.
    • Method Detail

      • writeJson

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

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

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

        java.io.Writer getJsonWriter()
                              throws java.io.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 segment
        Throws:
        java.io.IOException
      • writeBytes

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

        void writeBytes​(java.io.InputStream in)
                 throws java.io.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:
        java.io.IOException
      • getBytesOutputStream

        java.io.OutputStream getBytesOutputStream()
                                           throws java.io.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:
        java.io.IOException
      • close

        void close()
            throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.io.IOException