public class SAAJDataSource
extends java.lang.Object
implements javax.activation.DataSource
| Modifier and Type | Field and Description |
|---|---|
protected java.io.BufferedOutputStream |
cachediskstream
This is the cached disk stream.
|
protected boolean |
closed
If true the source input stream is now closed.
|
protected java.lang.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 |
deleted
Flag to show if the resources behind this have been deleted.
|
protected java.io.File |
diskCacheFile
Field diskCacheFile
|
static int |
MAX_MEMORY_DISK_CACHED
Field MAX_MEMORY_DISK_CACHED
|
protected int |
maxCached
Field maxCached
|
protected java.util.LinkedList |
memorybuflist
The linked list to hold the in memory buffers.
|
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 long |
totalsz
The total size in bytes in this data source.
|
| Modifier | Constructor and Description |
|---|---|
protected |
SAAJDataSource()
Constructor SAAJDataSource.
|
|
SAAJDataSource(java.io.InputStream ss,
int maxCached,
java.lang.String contentType)
Create a new boundary stream.
|
|
SAAJDataSource(java.io.InputStream ss,
int maxCached,
java.lang.String contentType,
boolean readall)
Create a new boundary stream.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
close()
This method is a low level write.
|
protected void |
flushToDisk()
Routine to flush data to disk if is in memory.
|
java.lang.String |
getContentType() |
java.io.File |
getDiskCacheFile()
get the filename of the content if it is cached to disk.
|
java.io.InputStream |
getInputStream() |
java.lang.String |
getName() |
java.io.OutputStream |
getOutputStream() |
protected void |
write(byte[] data)
Write bytes to the stream.
|
protected void |
write(byte[] data,
int length)
This method is a low level write.
|
protected void |
writeToMemory(byte[] data,
int length)
This method is a low level write.
|
protected java.lang.String contentType
application/octet-stream.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 java.util.LinkedList memorybuflist
protected byte[] currentMemoryBuf
protected int currentMemoryBufSz
protected long totalsz
protected java.io.BufferedOutputStream cachediskstream
protected boolean closed
protected SAAJDataSource()
public SAAJDataSource(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.IOExceptionpublic SAAJDataSource(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.IOExceptionprotected void close()
throws java.io.IOException
java.io.IOExceptionprotected void flushToDisk()
throws java.io.IOException,
java.io.FileNotFoundException
java.io.IOExceptionjava.io.FileNotFoundExceptionprotected void write(byte[] data)
throws java.io.IOException
data - all bytes of this array are written to the streamjava.io.IOException - if there was a problem writing the dataprotected void write(byte[] data,
int length)
throws java.io.IOException
data - length - java.io.IOExceptionprotected void writeToMemory(byte[] data,
int length)
throws java.io.IOException
data - length - java.io.IOExceptionpublic java.io.File getDiskCacheFile()
public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface javax.activation.DataSourcejava.io.IOExceptionpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in interface javax.activation.DataSourcejava.io.IOExceptionpublic java.lang.String getContentType()
getContentType in interface javax.activation.DataSourcepublic java.lang.String getName()
getName in interface javax.activation.DataSourceCopyright © 2004-2018 The Apache Software Foundation. All Rights Reserved.