|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.rdg.resc.jstyx.gridservice.server.GeneralCachingStreamReader
public abstract class GeneralCachingStreamReader
Abstract class that reads from an InputStream in a separate thread, caching the results to the local hard disk. Permits multiple clients to make DataRequests for data, replying with chunks of data when they are ready.
| Nested Class Summary | |
|---|---|
static class |
GeneralCachingStreamReader.DataRequest
Class representing a client that is waiting for data |
| Constructor Summary | |
|---|---|
GeneralCachingStreamReader()
|
|
| Method Summary | |
|---|---|
void |
delete()
Called when the file is removed from the server. |
abstract void |
error(GeneralCachingStreamReader.DataRequest originalRequest,
java.lang.Exception e)
|
java.io.File |
getCacheFile()
Gets the File that is being used to cache the contents of the stream |
long |
getCacheLength()
Gets the size of the cache in bytes |
boolean |
isEOF()
|
abstract void |
newData(GeneralCachingStreamReader.DataRequest originalRequest,
byte[] data,
int offset,
int count)
|
void |
read(GeneralCachingStreamReader.DataRequest dr)
Get data from the stream's cache. |
void |
setCacheFile(java.io.File cacheFile)
|
void |
startReading(java.io.InputStream is)
Sets the input stream from which the CachingStreamReader gets data and immediately starts reading from this stream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GeneralCachingStreamReader()
| Method Detail |
|---|
public java.io.File getCacheFile()
public long getCacheLength()
public void setCacheFile(java.io.File cacheFile)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic boolean isEOF()
public void startReading(java.io.InputStream is)
throws java.io.IOException
java.lang.IllegalStateException - if this object is already reading from a stream
java.io.IOException - if the cache file could not be createdpublic void read(GeneralCachingStreamReader.DataRequest dr)
public abstract void newData(GeneralCachingStreamReader.DataRequest originalRequest,
byte[] data,
int offset,
int count)
public abstract void error(GeneralCachingStreamReader.DataRequest originalRequest,
java.lang.Exception e)
public void delete()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||