edu.sdsc.inca.protocol
Class ProtocolWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.BufferedWriter
          extended byedu.sdsc.inca.protocol.ProtocolWriter

public class ProtocolWriter
extends java.io.BufferedWriter

Author:
Cathie Olschanowsky A buffered protocol writer. The same as a buffered Writer with the addition of a write method that will accept a Statement.

Field Summary
protected  boolean closed
           
static char[] CRLF
           
protected static org.apache.log4j.Logger logger
           
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ProtocolWriter(java.io.Writer writer)
          Create a buffered character-output stream that uses a default-sized output buffer.
ProtocolWriter(java.io.Writer writer, int i)
          Create a new buffered character-output stream that uses an output buffer of the given size.
 
Method Summary
 void close()
          Closes the writer.
 boolean isClosed()
          Indicates whether or not the writer has been closed.
 void write(Statement statement)
          Write a statement to the protocolWriter.
 
Methods inherited from class java.io.BufferedWriter
flush, newLine, write, write, write
 
Methods inherited from class java.io.Writer
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRLF

public static final char[] CRLF

logger

protected static org.apache.log4j.Logger logger

closed

protected boolean closed
Constructor Detail

ProtocolWriter

public ProtocolWriter(java.io.Writer writer)
Create a buffered character-output stream that uses a default-sized output buffer.

Parameters:
writer - the writer to send the data to

ProtocolWriter

public ProtocolWriter(java.io.Writer writer,
                      int i)
Create a new buffered character-output stream that uses an output buffer of the given size.

Parameters:
writer - to direct the output to
i - buffer size
Method Detail

close

public void close()
           throws java.io.IOException
Closes the writer.

Throws:
java.io.IOException - on a close error

isClosed

public boolean isClosed()
Indicates whether or not the writer has been closed.

Returns:
true if the writer is closed, else false

write

public void write(Statement statement)
           throws java.io.IOException
Write a statement to the protocolWriter.

Parameters:
statement - data to write
Throws:
java.io.IOException - if the write fails