com.uppaal.model.io2
Class CachedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.BufferedOutputStream
              extended by com.uppaal.model.io2.CachedOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class CachedOutputStream
extends BufferedOutputStream

CachedOutputStream buffers the stream while ignoring flushing. The content is flushed only upon close, so REMEMBER TO CLOSE IT. The purpose is to work around networked file systems which tend to flush too often and result in unbearably poor performance. Example: Microsoft DFS takes ~45s to save 65K xml document.

Author:
marius

Field Summary
 
Fields inherited from class java.io.BufferedOutputStream
buf, count
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
CachedOutputStream(File file)
           
CachedOutputStream(File file, int size)
           
CachedOutputStream(OutputStream out)
           
CachedOutputStream(OutputStream out, int size)
           
 
Method Summary
 void close()
           
 void flush()
           
 
Methods inherited from class java.io.BufferedOutputStream
write, write
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedOutputStream

public CachedOutputStream(OutputStream out)

CachedOutputStream

public CachedOutputStream(OutputStream out,
                          int size)

CachedOutputStream

public CachedOutputStream(File file)
                   throws FileNotFoundException
Throws:
FileNotFoundException

CachedOutputStream

public CachedOutputStream(File file,
                          int size)
                   throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

flush

public void flush()
Specified by:
flush in interface Flushable
Overrides:
flush in class BufferedOutputStream

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class FilterOutputStream
Throws:
IOException


Copyright © 2012 Uppsala University and Aalborg University. All Rights Reserved.