Package jetbrains.buildServer
Class StreamGobbler
- java.lang.Object
-
- java.lang.Thread
-
- jetbrains.buildServer.StreamGobbler
-
- All Implemented Interfaces:
java.lang.Runnable
public final class StreamGobbler extends java.lang.Thread
-
-
Constructor Summary
Constructors Constructor Description StreamGobbler(java.io.InputStream is)
StreamGobbler(java.io.InputStream inputStream, java.lang.Integer maxAcceptedOutputSize, java.lang.String commandDebug)
StreamGobbler(java.io.InputStream inputStream, java.lang.Integer maxAcceptedOutputSize, java.lang.String commandDebug, java.io.ByteArrayOutputStream outputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCommandDebug()
long
getLastActivityTimestamp()
byte[]
getReadBytes()
long
getReadLength()
java.lang.String
getReadString(java.nio.charset.Charset encoding)
boolean
isOutputOverload()
Return true if not whole content was recorded, due to its large sizevoid
notifyProcessExit()
void
run()
-
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
-
StreamGobbler
public StreamGobbler(java.io.InputStream is)
-
StreamGobbler
public StreamGobbler(java.io.InputStream inputStream, @Nullable java.lang.Integer maxAcceptedOutputSize, @NotNull java.lang.String commandDebug)
- Parameters:
maxAcceptedOutputSize
- maximum threshold of the data in stream (in bytes), which will be read. If output size is larger, further output will be ignored. Default - null - no limit.commandDebug
- debug text for error messages from this StreamCobbler
-
StreamGobbler
public StreamGobbler(@NotNull java.io.InputStream inputStream, @Nullable java.lang.Integer maxAcceptedOutputSize, @NotNull java.lang.String commandDebug, @NotNull java.io.ByteArrayOutputStream outputStream)
-
-
Method Detail
-
notifyProcessExit
public void notifyProcessExit()
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
getReadString
public java.lang.String getReadString(java.nio.charset.Charset encoding)
- Returns:
- content collected by this StreamGobbler as a string with given encoding
-
isOutputOverload
public boolean isOutputOverload()
Return true if not whole content was recorded, due to its large size
-
getReadBytes
public byte[] getReadBytes()
- Returns:
- content collected by this StreamGobbler as bytes
-
getLastActivityTimestamp
public long getLastActivityTimestamp()
- Returns:
- System.currentTimeMillis for the last moment when data was detected in output stream
-
getReadLength
public long getReadLength()
-
getCommandDebug
@NotNull public java.lang.String getCommandDebug()
-
-