Class InputStreamConnector
- java.lang.Object
-
- java.lang.Thread
-
- com.oracle.bedrock.runtime.remote.windows.winrm.InputStreamConnector
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable
public class InputStreamConnector extends Thread implements Closeable
AThreadthat connects anInputStreamto the stdin stream of an executing command.Copyright (c) 2015. All Rights Reserved. Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.- Author:
- Jonathan Knight
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInputStreamConnector(WindowsSession session, InputStream inputStream)Create anInputStreamConnectorthat listens to the specifiedInputStreamand pipes lines read from it to the stdin stream of the current command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close thisInputStreamConnectorInputStreamgetInputStream()Obtain theInputStreamthis connector pipes to the remote process stdin.WindowsSessiongetSession()Obtain theWindowsSessionrunning the remote process.protected booleanpollForInput(BufferedReader reader)Read a line from the specifiedBufferedReaderand send the data to the stdin stream of the remote process.voidrun()The run loop for thisInputStreamConnector.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
InputStreamConnector
protected InputStreamConnector(WindowsSession session, InputStream inputStream)
Create anInputStreamConnectorthat listens to the specifiedInputStreamand pipes lines read from it to the stdin stream of the current command.- Parameters:
session- theWindowsSessionrunning the commandinputStream- theInputStreamto pipe to the stdin stream of the command
-
-
Method Detail
-
getInputStream
public InputStream getInputStream()
Obtain theInputStreamthis connector pipes to the remote process stdin.- Returns:
- the
InputStreamthis connector pipes to the remote process stdin
-
getSession
public WindowsSession getSession()
Obtain theWindowsSessionrunning the remote process.- Returns:
- the
WindowsSessionrunning the remote process
-
close
public void close() throws IOExceptionClose thisInputStreamConnector- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
run
public void run()
The run loop for thisInputStreamConnector.
-
pollForInput
protected boolean pollForInput(BufferedReader reader)
Read a line from the specifiedBufferedReaderand send the data to the stdin stream of the remote process.- Parameters:
reader- theBufferedReaderto read a line of data from- Returns:
- true if a line was read or false if EOF was
read from the
BufferedReader.
-
-