edu.wisc.my.webproxy.beans.cache
Class CacheWriter

java.lang.Object
  extended by java.io.Writer
      extended by edu.wisc.my.webproxy.beans.cache.CacheWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class CacheWriter
extends Writer

Caching output stream. Takes a PageCache and the cache parameters along with an output stream to delegate the calls to. When close() is called on this class the bufferend content is written out to the PageCache.

Version:
$Revision: 20993 $
Author:
Eric Dalquist edalquist@unicon.net

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
CacheWriter(Writer out, CacheEntry entryBase, PageCache cache, String cacheKey, boolean persistData)
          Creates a new CacheWriter with the specified delegate stream and caching configuration.
 
Method Summary
 Writer append(char c)
           
 Writer append(CharSequence csq)
           
 Writer append(CharSequence csq, int start, int end)
           
 void close()
          Creates and stores a CacheEntry in the PageCache.
 void flush()
           
 void write(char[] cbuf)
           
 void write(char[] cbuf, int off, int len)
           
 void write(int c)
           
 void write(String str)
           
 void write(String str, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheWriter

public CacheWriter(Writer out,
                   CacheEntry entryBase,
                   PageCache cache,
                   String cacheKey,
                   boolean persistData)
Creates a new CacheWriter with the specified delegate stream and caching configuration.

Parameters:
out - The output stream to delegate cache calls to. If null no delegation is performed.
entryBase - The base CacheEntry to store, the content field will be overwritten before caching.
cache - The PageCache to use to store the data, may not be null.
cacheKey - The key to store the data with, may not be null.
persistData - If the data should be persisted by the store.
Method Detail

close

public void close()
           throws IOException
Creates and stores a CacheEntry in the PageCache.

Specified by:
close in interface Closeable
Specified by:
close in class Writer
Throws:
IOException
See Also:
OutputStream.close()

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Specified by:
flush in class Writer
Throws:
IOException
See Also:
OutputStream.flush()

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
Specified by:
write in class Writer
Throws:
IOException

append

public Writer append(char c)
              throws IOException
Specified by:
append in interface Appendable
Overrides:
append in class Writer
Throws:
IOException

append

public Writer append(CharSequence csq,
                     int start,
                     int end)
              throws IOException
Specified by:
append in interface Appendable
Overrides:
append in class Writer
Throws:
IOException

append

public Writer append(CharSequence csq)
              throws IOException
Specified by:
append in interface Appendable
Overrides:
append in class Writer
Throws:
IOException

write

public void write(char[] cbuf)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

write

public void write(int c)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

write

public void write(String str,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

write

public void write(String str)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException


Copyright © 2010 Jasig. All Rights Reserved.