org.apache.axis.attachments
public class ManagedMemoryDataSource extends Object implements DataSource
Field Summary | |
---|---|
protected BufferedOutputStream | cachediskstream This is the cached disk stream. |
protected boolean | closed If true the source input stream is now closed. |
protected String | contentType
The content type. |
protected byte[] | currentMemoryBuf Hold the last memory buffer. |
protected int | currentMemoryBufSz The number of bytes written to the above buffer. |
protected boolean | debugEnabled Field debugEnabled |
protected boolean | deleted
Flag to show if the resources behind this have been deleted. |
protected File | diskCacheFile Field diskCacheFile |
protected static Log | is_log Field is_log |
protected static Log | log Field log |
protected int | maxCached Field maxCached |
protected LinkedList | memorybuflist The linked list to hold the in memory buffers. |
static int | MAX_MEMORY_DISK_CACHED Field MAX_MEMORY_DISK_CACHED |
static int | MIN_MEMORY_DISK_CACHED Field MIN_MEMORY_DISK_CACHED |
protected WeakHashMap | readers Field readers |
static int | READ_CHUNK_SZ Field READ_CHUNK_SZ |
protected long | totalsz The total size in bytes in this data source. |
Constructor Summary | |
---|---|
protected | ManagedMemoryDataSource()
Constructor ManagedMemoryDataSource. |
ManagedMemoryDataSource(InputStream ss, int maxCached, String contentType)
Create a new boundary stream.
| |
ManagedMemoryDataSource(InputStream ss, int maxCached, String contentType, boolean readall)
Create a new boundary stream.
|
Method Summary | |
---|---|
protected void | close()
This method is a low level write.
|
boolean | delete() |
protected void | finalize() |
protected void | flushToDisk()
Routine to flush data to disk if is in memory.
|
String | getContentType()
This method returns the MIME type of the data in the form of a string. |
File | getDiskCacheFile()
get the filename of the content if it is cached to disk. |
InputStream | getInputStream()
This method returns an InputStream representing the the data and throws the appropriate exception if it can not do so. |
String | getName()
This will flush any memory source to disk and
provide the name of the file if desired.
|
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(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.
|
application/octet-stream
.Parameters: 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.
Throws: java.io.IOException
Parameters: 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.
Throws: java.io.IOException
Throws: java.io.IOException
Throws: java.io.IOException java.io.FileNotFoundException
Returns: The mime type.
Returns: file object pointing to file, or null for memory-stored content
Returns: the java.io.InputStream for the data source.
Throws: java.io.IOException
Returns: the name of the file of the stream
Returns: always null
Throws: java.io.IOException
Parameters: arg
Parameters: data all bytes of this array are written to the stream
Throws: java.io.IOException if there was a problem writing the data
Parameters: data length
Throws: java.io.IOException