Interface IOCallback<T>

Type Parameters:
T - the type of the stream, reader, writer, or input object
All Known Subinterfaces:
InputStreamCallback, OutputStreamCallback, PrintStreamCallback, ReaderCallback, WriterCallback
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 IOCallback<T>
Callback function used for an I/O operation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept(T stream)
    Invokes this callback with the given stream, reader, writer, or object.
  • Method Details

    • accept

      void accept(T stream) throws IOException
      Invokes this callback with the given stream, reader, writer, or object.

      When dealing with a stream, reader, or writer, any resources are automatically closed when the callback returns. Thus, the callback itself does not need close the stream. However, the callback should throw an exception if the operation failed and needs to be aborted.

      Parameters:
      stream - the stream, reader, or writer
      Throws:
      IOException - if an I/O error occurred