Interface IWriteToWriter

All Known Implementing Classes:
NonBlockingCharArrayWriter, NonBlockingStringWriter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface IWriteToWriter
A simple interface for objects that can write to a Writer.
Since:
v12.0.0
Author:
Philip Helger
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    writeTo(@NonNull Writer aWriter)
    Write everything to the passed writer.
    default void
    writeToAndClose(@NonNull Writer aWriter)
    Write everything to the passed writer and close it.
  • Method Details

    • writeTo

      void writeTo(@WillNotClose @NonNull Writer aWriter) throws IOException
      Write everything to the passed writer.
      Parameters:
      aWriter - The writer to write to. May not be null. The writer must not closed by implementations of this class.
      Throws:
      IOException - In case of IO error
    • writeToAndClose

      default void writeToAndClose(@WillClose @NonNull Writer aWriter) throws IOException
      Write everything to the passed writer and close it.
      Parameters:
      aWriter - The writer to write to. May not be null.
      Throws:
      IOException - In case of IO error. Even than the writer is closed!