phelps.io
Class InputStreamCached
public
class
InputStreamCached
extends FilterInputStream
Incrementally caches data to a cache file as it streams.
If the data is needed as a random-access file, rather than a stream,
getFile reads all the data from the stream to disk (if not already cached),
then returns a handle to the cached location.
This class is a low-level data mover,
underneath a cache management policy that determines whether already cached and if so whether to refresh,
and the path for the cache file.
Version: $Revision: 1.2 $ $Date: 2002/10/24 21:21:33 $
Method Summary |
void | cancel()
Cancel: terminate gracefully by closing streams and delete any incomplete cache file. |
void | close()
Open a stream from the file, which can easily be
Provides a uniform interface to local files as to network URIs.
|
File | getFile()
Read all data from stream into a file, close both input and file-writing streams, then return the file. |
int | read() |
int | read(byte[] b, int off, int len) |
String | toString() |
public InputStreamCached(InputStream in, File infile, File cacheto)
Read from in and write to cacheto.
Simple byte copier; cacheing policies to be performed by client.
public void cancel()
Cancel: terminate gracefully by closing streams and delete any incomplete cache file.
public void close()
Open a stream from the file, which can easily be
Provides a uniform interface to local files as to network URIs.
public InputStreamCached(File file) throws FileNotFoundException {
//super(new BufferedInputStream(new FileInputStream(file), 8*1024)); // wrapping in BufferedInputStream client option
assert file!=null;
outfile_ = file;
System.out.println(" in = out = "+outfile_);
out_ = null;
}
public File getFile()
Read all data from stream into a file,
close both input and file-writing streams, then return the file.
public int read()
public int read(byte[] b, int off, int len)
public String toString()