Blackbox

interface Blackbox

Unified interface for anything that receives and responds to input without any access to or relevance for its internal states.

Should be able to wrap STDIN/STDOUT, pipes, JNI, NDK, network sockets, external processes, embedded code, etc, and make them all interchangeable.

Functions

equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
read
Link copied to clipboard
open fun read(block: Boolean = true): String
readAll
Link copied to clipboard
open fun readAll(block: Boolean = true, limit: Int = 0): List<String>

Read out all lines up to a limit if given a limit greater than zero.

start
Link copied to clipboard
open fun start()
stop
Link copied to clipboard
open fun stop(): Exception?

Try to shut down this black box.

toString
Link copied to clipboard
open fun toString(): String
write
Link copied to clipboard
open fun write(string: String)

Write a single string to the black box.

Properties

isAlive
Link copied to clipboard
open val isAlive: Boolean

Whether this black box is "running", and able to receive and respond to input.

readyForRead
Link copied to clipboard
open val readyForRead: Int

Approximate number of items ready to be read. Should try to always return 0 correctly, but may return 1 if a greater number of items are available.

readyForWrite
Link copied to clipboard
open val readyForWrite: Boolean

Whether this black box is ready to be written to.

Inheritors

SubprocessBlackbox
Link copied to clipboard

Sources

jvm source
Link copied to clipboard