net.codescore.exe
Class StreamWriter

java.lang.Object
  extended by java.lang.Thread
      extended by net.codescore.exe.StreamWriter
All Implemented Interfaces:
Runnable

public class StreamWriter
extends Thread

This class handles a writing a process's output stream (std or err) to file and copying it into the database for the submission. Use the Thread.start() to begin monitoring the stream.

Author:
Adam Cornett

Nested Class Summary
static class StreamWriter.OutputMode
           
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  File f
           
private  StringBuilder file
           
private  InputStream in
           
private  org.apache.commons.logging.Log log
           
private  StreamWriter.OutputMode mode
           
private  Submission s
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
StreamWriter(File outF, InputStream in, Submission s, StreamWriter.OutputMode mode)
           
 
Method Summary
protected  void cleanup()
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

f

private final File f

file

private final StringBuilder file

in

private final InputStream in

log

private org.apache.commons.logging.Log log

mode

private final StreamWriter.OutputMode mode

s

private final Submission s
Constructor Detail

StreamWriter

public StreamWriter(File outF,
                    InputStream in,
                    Submission s,
                    StreamWriter.OutputMode mode)
Parameters:
outF - The file to write the steam out to
in - The input stream to read from
s - The submission to work with
mode - What file should be used, Compile or Execution and Standard Error or Standard Out.
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

cleanup

protected void cleanup()
                throws IOException
Throws:
IOException


Copyright 2008 © Adam Cornett, Andrew Conner All Rights Reserved.