![]() |
All Packages This Package Class Hierarchy Class Search Index Class calypso.util.CacheOutputStreamjava.lang.Object | +----java.io.OutputStream | +----calypso.util.CacheOutputStream
This class provides buffering for arbitrarily large streams of data. It is an OutputStream, so you just write the data you want to cache to it. Then, when you've written all of your data (and called close()) you can get the data back by calling makeInputStream(), which returns an InputStream. If you decide you don't want the data at all, you should call discardBuffer() as early as possible, to avoid having a temporary file stay around longer than necessary. It's not necessary to call discardBuffer() if you have called makeInputStream(); it is called automatically when that stream is closed. However, it is ok to call discardBuffer() than once. So, one conservative way of using this would be:
try { ... write bytes to `output' ... output.close(); InputStream input = output.makeInputStream(); try { ... read bytes from `input' ... } finally { input.close(); } } finally { output.discardBuffer(); }
public class CacheOutputStream
extends java.io.OutputStream
{
// Fields 6
protected Object bs_handle;
protected OutputStream bs_stream;
protected byte[] mem_cache;
protected int mem_cache_fp;
protected double mem_cache_increment;
protected int mem_cache_max_size;
// Constructors 3
public CacheOutputStream();
public CacheOutputStream(int);
public CacheOutputStream(int, int);
// Methods 13
public void close() throws IOException;
protected InputStream createBackingStoreInputStream() throws FileNotFoundException;
protected void discardBackingStore();
public synchronized void discardBuffer();
protected void finalize();
public void flush() throws IOException;
protected void growMemCache(int) throws IOException;
protected void increaseCapacity(int) throws IOException;
public InputStream makeInputStream() throws IOException, FileNotFoundException;
protected void switchToBackingStore() throws IOException;
public void write(byte[]) throws IOException;
public void write(byte[], int, int) throws IOException;
public void write(int) throws IOException;
}
Fields mem_cacheprotected byte[] mem_cache mem_cache_fpprotected int mem_cache_fp mem_cache_max_sizeprotected int mem_cache_max_size mem_cache_incrementprotected double mem_cache_increment bs_handleprotected Object bs_handle bs_streamprotected OutputStream bs_stream
Constructors CacheOutputStreampublic CacheOutputStream()
CacheOutputStreampublic CacheOutputStream(int max_resident_size)
CacheOutputStream
public CacheOutputStream(int probable_size,
int max_resident_size)
Methods writepublic void write(byte[] bytes) throws IOException
write
public void write(byte[] bytes,
int start,
int length) throws IOException
writepublic void write(int b) throws IOException
closepublic void close() throws IOException
flushpublic void flush() throws IOException
increaseCapacityprotected void increaseCapacity(int count) throws IOException
growMemCacheprotected void growMemCache(int count) throws IOException
discardBufferpublic synchronized void discardBuffer()
makeInputStreampublic InputStream makeInputStream() throws IOException, FileNotFoundException
finalizeprotected void finalize() switchToBackingStoreprotected void switchToBackingStore() throws IOException
discardBackingStoreprotected void discardBackingStore()
createBackingStoreInputStreamprotected InputStream createBackingStoreInputStream() throws FileNotFoundException
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4 |
|
|
Copyright © 1998-2000 The Mozilla Organization.
Last modified December 25, 1998. |
|