Interface Json.Encoder

Enclosing class:
Json

public static interface Json.Encoder

Writes values of one type as JSON, shared by every request that answers with that type.

The stateless counterpart of Json.Writable. A Writable carries the value it writes, so a route answering with a codec had to allocate one per request to hold that value; an Encoder is handed the value instead, so a generated route keeps ONE in a static field and a request allocates only what the method returned. See HttpServer.Request.respondJson(int, Object, Encoder).

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    write(Object value, ByteSink out)
    Writes value, never null, into out.
  • Method Details

    • write

      void write(Object value, ByteSink out)
      Writes value, never null, into out.