Package com.uppaal.model.io2
Class CachedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.BufferedOutputStream
-
- com.uppaal.model.io2.CachedOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class CachedOutputStream extends java.io.BufferedOutputStreamCachedOutputStream 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
-
-
Constructor Summary
Constructors Constructor Description CachedOutputStream(java.io.File file)CachedOutputStream(java.io.File file, int size)CachedOutputStream(java.io.OutputStream out)CachedOutputStream(java.io.OutputStream out, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()
-
-
-
Constructor Detail
-
CachedOutputStream
public CachedOutputStream(java.io.OutputStream out)
-
CachedOutputStream
public CachedOutputStream(java.io.OutputStream out, int size)
-
CachedOutputStream
public CachedOutputStream(java.io.File file) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
CachedOutputStream
public CachedOutputStream(java.io.File file, int size) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
-
Method Detail
-
flush
public void flush()
- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.BufferedOutputStream
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
-