Class RefusingObjectOutputStream

java.lang.Object
java.io.OutputStream
java.io.ObjectOutputStream
de.aristaflow.adept2.util.injection.RefusingObjectOutputStream
All Implemented Interfaces:
Closeable, DataOutput, Flushable, ObjectOutput, ObjectStreamConstants, AutoCloseable

public final class RefusingObjectOutputStream extends ObjectOutputStream
An ObjectOutputStream refusing InjectionAware objects, the mirror of RefusingObjectInputStream on the write side. It is the first guarantee moved earlier rather than a second one: anything a plain helper writes is read by a plain helper, so the refusal would have come regardless – at the consumer, possibly a persistence round-trip later, and with the stack trace of the consumer instead of the one of the producer. Where nothing reads the bytes back in this process, a persisted file or a digest, the write side is the only side there is.

The refusal happens where the graph that travels becomes visible, that is after a writeReplace and for every object actually written, so it is graph-deep as well.

  • Constructor Details

    • RefusingObjectOutputStream

      public RefusingObjectOutputStream(OutputStream out) throws IOException
      Creates a refusing stream writing to the designated output stream.
      Parameters:
      out - The output stream to write the objects to.
      Throws:
      IOException - If the header cannot be written to the designated output stream, an IOException will be thrown.
  • Method Details