com.caucho.vfs
Class NullWriteStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.caucho.vfs.OutputStreamWithBuffer
          extended by com.caucho.vfs.WriteStream
              extended by com.caucho.vfs.NullWriteStream
All Implemented Interfaces:
ByteAppendable, LockableStream, java.io.Closeable, java.io.Flushable

public class NullWriteStream
extends WriteStream

A WriteStream that writes to nothing.


Constructor Summary
NullWriteStream()
           
 
Method Summary
 boolean canWrite()
          Returns true if the buffer allows writes.
 void flush()
          Flushes the buffer to the source.
 void write(byte[] buf)
          Writes a byte array.
 void write(byte[] buf, int offset, int length)
          Writes a byte array
 void write(int ch)
          Writes a byte.
 
Methods inherited from class com.caucho.vfs.WriteStream
clearPosition, clearWrite, close, flushBuffer, flushToDisk, free, getAttribute, getAttributeNames, getBuffer, getBufferOffset, getBufferSize, getDisableClose, getEncoding, getJavaEncoding, getNewlineString, getPath, getPosition, getPrintWriter, getRemaining, getSource, getUserPath, init, isClosed, lock, log, log, nextBuffer, print, print, print, print, print, print, print, print, print, print, print, print, printLatin1, printLatin1, printLatin1NoLf, println, println, println, println, println, println, println, println, println, println, pushFilter, removeAttribute, seekEnd, seekStart, setAttribute, setBufferOffset, setDisableClose, setDisableCloseSource, setEncoding, setFlushOnNewline, setImplicitFlush, setLocale, setNewlineString, setPath, setPosition, setReuseBuffer, setSysNewline, setSystemNewline, toString, unlock, writeFile, writeStream, writeStream, writeStream, writeStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NullWriteStream

public NullWriteStream()
Method Detail

canWrite

public boolean canWrite()
Description copied from class: WriteStream
Returns true if the buffer allows writes.

LogStreams, used for debugging, use this feature to test if they should write with very little overhead.

 if (dbg.canWrite())
   dbg.log("some debug value " + expensiveDebugCalculation(foo));
 

Overrides:
canWrite in class WriteStream

write

public void write(int ch)
           throws java.io.IOException
Writes a byte.

Specified by:
write in interface ByteAppendable
Overrides:
write in class WriteStream
Throws:
java.io.IOException

write

public void write(byte[] buf,
                  int offset,
                  int length)
           throws java.io.IOException
Writes a byte array

Specified by:
write in interface ByteAppendable
Overrides:
write in class WriteStream
Throws:
java.io.IOException

write

public void write(byte[] buf)
           throws java.io.IOException
Writes a byte array.

Overrides:
write in class WriteStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes the buffer to the source.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class WriteStream
Throws:
java.io.IOException