|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.axis.attachments.ManagedMemoryDataSource
This class allows small attachments to be cached in memory, while large ones are cached out. It implements a Java Activiation Data source interface. TODO TODO TODO need to delete cached out data sources after a service ends.
Field Summary | |
protected java.io.BufferedOutputStream |
cachediskstream
Field cachediskstream |
protected boolean |
closed
Field closed |
protected java.lang.String |
contentType
Field contentType |
protected byte[] |
currentMemoryBuf
Field currentMemoryBuf |
protected int |
currentMemoryBufSz
Field currentMemoryBufSz |
protected boolean |
debugEnabled
Field debugEnabled |
protected boolean |
deleted
Field deleted |
protected java.io.File |
diskCacheFile
Field diskCacheFile |
protected static org.apache.commons.logging.Log |
is_log
Field is_log |
protected static org.apache.commons.logging.Log |
log
Field log |
static int |
MAX_MEMORY_DISK_CACHED
Field MAX_MEMORY_DISK_CACHED |
protected int |
maxCached
Field maxCached |
protected java.util.LinkedList |
memorybuflist
Field memorybuflist |
static int |
MIN_MEMORY_DISK_CACHED
Field MIN_MEMORY_DISK_CACHED |
static int |
READ_CHUNK_SZ
Field READ_CHUNK_SZ |
protected java.util.WeakHashMap |
readers
Field readers |
protected int |
totalsz
Field totalsz |
Constructor Summary | |
protected |
ManagedMemoryDataSource()
Constructor ManagedMemoryDataSource |
|
ManagedMemoryDataSource(java.io.InputStream ss,
int maxCached,
java.lang.String contentType)
Create a new boundary stream; |
|
ManagedMemoryDataSource(java.io.InputStream ss,
int maxCached,
java.lang.String contentType,
boolean readall)
Create a new boundary stream; |
Method Summary | |
protected void |
close()
This method is a low level write. |
boolean |
delete()
Method delete |
protected void |
finalize()
Method finalize |
protected void |
flushToDisk()
Routine to flush data to disk if is in memory. |
java.lang.String |
getContentType()
This method returns the MIME type of the data in the form of a string. |
java.io.File |
getDiskCacheFile()
get the filename of the content if it is cached to disk. |
java.io.InputStream |
getInputStream()
This method returns an InputStream representing the the data and throws the appropriate exception if it can not do so. |
java.lang.String |
getName()
This will flush any memory source to disk and provide the name of the file if desired. |
java.io.OutputStream |
getOutputStream()
This method returns an OutputStream where the data can be written and throws the appropriate exception if it can not do so. |
static void |
main(java.lang.String[] arg)
Method main |
protected void |
write(byte[] data)
Write bytes to the stream. |
protected void |
write(byte[] data,
int length)
This method is a low level write. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static org.apache.commons.logging.Log log
protected java.lang.String contentType
public static final int MIN_MEMORY_DISK_CACHED
public static final int MAX_MEMORY_DISK_CACHED
protected int maxCached
protected java.io.File diskCacheFile
protected java.util.WeakHashMap readers
protected boolean deleted
public static final int READ_CHUNK_SZ
protected boolean debugEnabled
protected java.util.LinkedList memorybuflist
protected byte[] currentMemoryBuf
protected int currentMemoryBufSz
protected int totalsz
protected java.io.BufferedOutputStream cachediskstream
protected boolean closed
protected static org.apache.commons.logging.Log is_log
Constructor Detail |
protected ManagedMemoryDataSource()
public ManagedMemoryDataSource(java.io.InputStream ss, int maxCached, java.lang.String contentType) throws java.io.IOException
ss
- is the source input stream that is used to create this data source..maxCached
- This is the max memory that is to be used to cache the data.contentType
- the mime type for this data stream.
by buffering you can some effiency in searching.java.io.IOException
- public ManagedMemoryDataSource(java.io.InputStream ss, int maxCached, java.lang.String contentType, boolean readall) throws java.io.IOException
ss
- is the source input stream that is used to create this data source..maxCached
- This is the max memory that is to be used to cache the data.contentType
- the mime type for this data stream.
by buffering you can some effiency in searching.readall
- if true will read in the whole source.java.io.IOException
- Method Detail |
public java.lang.String getContentType()
getContentType
in interface javax.activation.DataSource
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface javax.activation.DataSource
java.io.IOException
- public java.lang.String getName()
getName
in interface javax.activation.DataSource
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface javax.activation.DataSource
java.io.IOException
- protected void write(byte[] data) throws java.io.IOException
data
- all bytes of this array are written to the stream.java.io.IOException
- protected void write(byte[] data, int length) throws java.io.IOException
data
- length
- java.io.IOException
- protected void close() throws java.io.IOException
java.io.IOException
- protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- protected void flushToDisk() throws java.io.IOException, java.io.FileNotFoundException
java.io.IOException
- java.io.FileNotFoundException
- public boolean delete()
public static void main(java.lang.String[] arg)
arg
- public java.io.File getDiskCacheFile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |