Package aQute.remote.agent
Class RedirectInput
java.lang.Object
java.io.InputStream
aQute.remote.agent.RedirectInput
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
Shell
An filter stream that takes a string from the supervisor and then provides it
as a read to the user of this Input Stream. It also dispatches the text to an
original stream.It does not use Piped*Stream because they turned hard to
break. This implementation uses a ring buffer.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a redirector without an originalCreate a redirector input stream with an original input stream -
Method Summary
Modifier and TypeMethodDescriptionvoidProvide the string that should be treated as input for the running code.voidclose()getOrg()Get the original inputstream, potentially nullintread()Read a byte from the input buffer.intread(byte[] buffer) intread(byte[] buffer, int offset, int length) And the read for a larger bufferMethods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
RedirectInput
Create a redirector input stream with an original input stream- Parameters:
in- the original- Throws:
IOException
-
RedirectInput
public RedirectInput()Create a redirector without an original
-
-
Method Details
-
getOrg
Get the original inputstream, potentially null- Returns:
- null or the original input stream
-
add
Provide the string that should be treated as input for the running code.- Parameters:
s- the string- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
read
Read a byte from the input buffer. We will be fully interruptible, in the case of an interrupt we return -1 (eof)- Specified by:
readin classInputStream- Throws:
IOException
-
read
And the read for a larger buffer- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-