com.caucho.vfs
Class ClassLoaderStream

java.lang.Object
  |
  +--com.caucho.vfs.StreamImpl
        |
        +--com.caucho.vfs.ClassLoaderStream
Direct Known Subclasses:
ContextStream

public class ClassLoaderStream
extends StreamImpl

A stream that varies depending on the context class loader.


Fields inherited from class com.caucho.vfs.StreamImpl
nullPath, path
 
Constructor Summary
ClassLoaderStream(java.lang.String contextVariable, java.io.OutputStream defaultStream)
          Create the context stream.
 
Method Summary
 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 getDefaultStream()
          Returns the context stream's variable.
static ClassLoaderStream getStderr()
           
static ClassLoaderStream getStdout()
           
 java.io.OutputStream getStream()
          Gets the current write stream
 java.lang.String getVariable()
          Returns the context stream's variable.
 void setDefaultStream(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
 void setStream(java.io.OutputStream os)
          Sets the current write stream.
 void write(byte[] buf, int offset, int length, boolean isEnd)
          Write data to the stream.
 
Methods inherited from class com.caucho.vfs.StreamImpl
canRead, clearWrite, getAttribute, getAttributeNames, getAvailable, getFlushOnNewline, getNewline, getPath, getReadPosition, hasSkip, read, removeAttribute, setAttribute, setPath, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderStream

public ClassLoaderStream(java.lang.String contextVariable,
                         java.io.OutputStream defaultStream)
Create the context stream.
Parameters:
contextVariable - the variable for the underlying stream
Method Detail

setStdout

public static void setStdout(java.io.OutputStream os)
Sets the backing stream for System.out

getStdout

public static ClassLoaderStream getStdout()

setStderr

public static void setStderr(java.io.OutputStream os)
Sets path as the backing stream for System.err

getStderr

public static ClassLoaderStream getStderr()

getVariable

public java.lang.String getVariable()
Returns the context stream's variable.

getDefaultStream

public java.io.OutputStream getDefaultStream()
Returns the context stream's variable.

setDefaultStream

public void setDefaultStream(java.io.OutputStream defaultStream)
Returns the context stream's variable.

canWrite

public boolean canWrite()
True if the stream can write
Overrides:
canWrite in class StreamImpl

write

public void write(byte[] buf,
                  int offset,
                  int length,
                  boolean isEnd)
           throws java.io.IOException
Write data to the stream.
Overrides:
write in class StreamImpl
Following copied from class: com.caucho.vfs.StreamImpl
Parameters:
buffer - 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.

flush

public void flush()
           throws java.io.IOException
Flush data to the stream.
Overrides:
flush in class StreamImpl

close

public void close()
           throws java.io.IOException
Flush data to the stream.
Overrides:
close in class StreamImpl

setStream

public void setStream(java.io.OutputStream os)
Sets the current write stream.

getStream

public java.io.OutputStream getStream()
Gets the current write stream