public class EnvironmentStream extends StreamImpl
_nullPath, _path
Constructor and Description |
---|
EnvironmentStream(java.io.OutputStream defaultStream)
Create the environment stream.
|
EnvironmentStream(java.lang.String envVariable,
java.io.OutputStream defaultStream)
Create the environment stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canWrite()
True if the stream can write
|
void |
close()
Flush data to the stream.
|
void |
flush()
Flush data to the stream.
|
java.io.OutputStream |
getGlobalStream()
Returns the global stream
|
static WriteStream |
getOriginalSystemErr()
Returns the original System.out writer
|
static WriteStream |
getOriginalSystemOut()
Returns the original System.out writer
|
static EnvironmentStream |
getStderr()
Returns the environment stream for System.err
|
static EnvironmentStream |
getStdout()
Returns the environment stream for System.out
|
java.io.OutputStream |
getStream()
Returns the global stream
|
java.lang.String |
getVariable()
Returns the context stream's variable.
|
static void |
logStderr(java.lang.String msg)
Logs a message to the original stderr in cases where java.util.logging
is dangerous, e.g.
|
static void |
logStderr(java.lang.String msg,
java.lang.Throwable e)
Logs a message to the original stderr in cases where java.util.logging
is dangerous, e.g.
|
java.lang.Object |
setGlobalStream(java.io.OutputStream defaultStream)
Returns the context stream's variable.
|
static void |
setStderr(java.io.OutputStream os)
Sets path as the backing stream for System.err
|
static void |
setStdout(java.io.OutputStream os)
Sets the backing stream for System.out
|
java.lang.Object |
setStream(java.io.OutputStream os)
Returns the context stream's variable.
|
void |
write(byte[] buf,
int offset,
int length,
boolean isEnd)
Write data to the stream.
|
canRead, clearWrite, closeWrite, flushBuffer, flushToDisk, getAttribute, getAttributeNames, getAvailable, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, hasSkip, isClosed, isEof, isMmapEnabled, isSendfileEnabled, read, readNonBlock, readTimeout, removeAttribute, seekEnd, seekStart, setAttribute, setPath, setWriteEncoding, skip, write, writeMmap, writeSendfile
public EnvironmentStream(java.lang.String envVariable, java.io.OutputStream defaultStream)
envVariable
- the variable for the underlying streamdefaultStream
- the stream used if outside an environmentpublic EnvironmentStream(java.io.OutputStream defaultStream)
defaultStream
- the stream used if outside an environmentpublic java.lang.String getVariable()
public java.io.OutputStream getGlobalStream()
public java.lang.Object setGlobalStream(java.io.OutputStream defaultStream)
public java.io.OutputStream getStream()
public java.lang.Object setStream(java.io.OutputStream os)
public boolean canWrite()
canWrite
in class StreamImpl
public void write(byte[] buf, int offset, int length, boolean isEnd) throws java.io.IOException
write
in class StreamImpl
buf
- the byte array to write.offset
- the offset into the byte array.length
- the number of bytes to write.isEnd
- true when the write is flushing a close.java.io.IOException
public void flush() throws java.io.IOException
flush
in class StreamImpl
java.io.IOException
public void close() throws java.io.IOException
close
in class StreamImpl
java.io.IOException
public static void setStdout(java.io.OutputStream os)
public static EnvironmentStream getStdout()
public static WriteStream getOriginalSystemOut()
public static void setStderr(java.io.OutputStream os)
public static EnvironmentStream getStderr()
public static WriteStream getOriginalSystemErr()
public static void logStderr(java.lang.String msg, java.lang.Throwable e)
public static void logStderr(java.lang.String msg)