org.jasig.portal.serialize
Class CachingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jasig.portal.serialize.CachingOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, CharacterCachingWriter

public class CachingOutputStream
extends java.io.OutputStream
implements CharacterCachingWriter


Field Summary
(package private)  java.io.ByteArrayOutputStream cache
           
(package private)  boolean caching
           
(package private)  java.io.OutputStream out
           
 
Constructor Summary
CachingOutputStream(java.io.OutputStream out)
           
 
Method Summary
 void close()
           
 void flush()
           
 java.lang.String getCache(java.lang.String encoding)
           
 boolean startCaching()
           
 boolean stopCaching()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

java.io.OutputStream out

cache

java.io.ByteArrayOutputStream cache

caching

boolean caching
Constructor Detail

CachingOutputStream

public CachingOutputStream(java.io.OutputStream out)
Method Detail

startCaching

public boolean startCaching()
                     throws java.io.IOException
Specified by:
startCaching in interface CharacterCachingWriter
Throws:
java.io.IOException

getCache

public java.lang.String getCache(java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException,
                                 java.io.IOException
Specified by:
getCache in interface CharacterCachingWriter
Throws:
java.io.UnsupportedEncodingException
java.io.IOException

stopCaching

public boolean stopCaching()
Specified by:
stopCaching in interface CharacterCachingWriter

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in interface CharacterCachingWriter
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException