Interface IWriteToStream

All Known Implementing Classes:
ByteBufferOutputStream, NonBlockingByteArrayOutputStream
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 IWriteToStream
A simple interface for objects that can write to an OutputStream.
Author:
Philip Helger
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Write everything to the passed output stream.
    default void
    Write everything to the passed output stream and close it.
  • Method Details

    • writeTo

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

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