Interface DataWriter

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
SmartSocketWriter, SocketWriter

public interface DataWriter extends AutoCloseable
Write data to the underlying transport (most likely a socket). Do not combine write(io.helidon.common.buffers.BufferData) and writeNow(io.helidon.common.buffers.BufferData) to a single underlying transport, unless you can guarantee there will not be a race between these two methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Closes this writer and frees any associated resources.
    default void
    Flushes to the underlying transport any pending data that has been written using either write(BufferData) or write(BufferData...).
    void
    write(BufferData buffer)
    Write buffer, may delay writing and may write on a different thread.
    void
    write(BufferData... buffers)
    Write buffers, may delay writing and may write on a different thread.
    void
    Write buffer to underlying transport blocking until the buffer is written.
    void
    writeNow(BufferData... buffers)
    Write buffers to underlying transport blocking until the buffers are written.
  • Method Details

    • write

      void write(BufferData... buffers)
      Write buffers, may delay writing and may write on a different thread. This method also may combine multiple calls into a single write to the underlying transport.
      Parameters:
      buffers - buffers to write
    • write

      void write(BufferData buffer)
      Write buffer, may delay writing and may write on a different thread. This method also may combine multiple calls into a single write to the underlying transport.
      Parameters:
      buffer - buffer to write
    • writeNow

      void writeNow(BufferData... buffers)
      Write buffers to underlying transport blocking until the buffers are written.
      Parameters:
      buffers - buffers to write
    • writeNow

      void writeNow(BufferData buffer)
      Write buffer to underlying transport blocking until the buffer is written.
      Parameters:
      buffer - buffer to write
    • flush

      default void flush()
      Flushes to the underlying transport any pending data that has been written using either write(BufferData) or write(BufferData...).
    • close

      default void close()
      Closes this writer and frees any associated resources. Defaults to just a call to flush().
      Specified by:
      close in interface AutoCloseable