StreamSubstitutionManager

abstract class StreamSubstitutionManager<StreamT : Closeable>(systemStreamProp: KMutableProperty0<StreamT>, kernelStreamProp: KMutableProperty0<StreamT>?, delegatingStreamFactory: (delegateFactory: () -> StreamT) -> StreamT, substitutionEngineType: StreamSubstitutionType)

An abstract class designed to manage substituting of standard streams with some custom streams.

Parameters

StreamT

The type of the stream, which must be a subtype of Closeable.

systemStreamProp

A mutable property representing the system stream. I.e., for STDOUT, it's the pair of System.out and System.setOut

kernelStreamProp

A mutable property representing the kernel stream, which can be null. Kernel stream is a separate globally available property, but it might be accessed only by the kernel facilities, not by the external code.

substitutionEngineType

The type of stream substitution engine to use.

Classes StdOut, StdErr, and StdIn extend this class for specific stream handling.

Inheritors

Constructors

Link copied to clipboard
constructor(systemStreamProp: KMutableProperty0<StreamT>, kernelStreamProp: KMutableProperty0<StreamT>?, delegatingStreamFactory: (delegateFactory: () -> StreamT) -> StreamT, substitutionEngineType: StreamSubstitutionType)

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun <T> withSubstitutedStreams(systemStreamFactory: (initial: StreamT?) -> StreamT, kernelStreamFactory: (initial: StreamT?) -> StreamT?, body: () -> T): T