Interface JsonOutput

All Superinterfaces:
AutoCloseable, Closeable

public interface JsonOutput extends Closeable
Output that can be aware of server content chunking.

Typically, for HTTP servers that can send output using fixed length or chunked.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Flush the underlying OutputStream.
    static JsonOutput
    of(io.helidon.webserver.http.ServerResponse nimaServerResponse)
    Create for Nima ServerResponse.
    static JsonOutput
    of(OutputStream outputStream)
    Create as a simple wrapper for OutputStream.
    Return the underlying OutputStream.
    void
    write(byte[] content, int offset, int length)
    Write the content to the underlying output stream.
    default void
    writeLast(byte[] content, int offset, int length)
    Write the last content to the underlying output stream.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • of

      static JsonOutput of(OutputStream outputStream)
      Create as a simple wrapper for OutputStream.
    • of

      static JsonOutput of(io.helidon.webserver.http.ServerResponse nimaServerResponse)
      Create for Nima ServerResponse.
    • write

      void write(byte[] content, int offset, int length) throws IOException
      Write the content to the underlying output stream.
      Throws:
      IOException
    • writeLast

      default void writeLast(byte[] content, int offset, int length) throws IOException
      Write the last content to the underlying output stream.

      Given that this is known to be the last content written an implementation can make use of this to optimise for sending as fixed length content.

      Throws:
      IOException
    • flush

      void flush() throws IOException
      Flush the underlying OutputStream.
      Throws:
      IOException
    • unwrapOutputStream

      OutputStream unwrapOutputStream()
      Return the underlying OutputStream.

      This is used for Jsonb adapters (Jackson) that can't support writeLast() semantics.