public class SwapableMemoryDataSource extends Object implements DataSource
Constructor and Description |
---|
SwapableMemoryDataSource(InputStream inputStream,
String contentType)
Constructs a
SwapableMemoryDataSource from inputStream, and contentType. |
SwapableMemoryDataSource(InputStream inputStream,
String contentType,
int maxMemorySize)
Constructs a
SwapableMemoryDataSource from inputStream, and
contentType. |
Modifier and Type | Method and Description |
---|---|
void |
cleanup() |
protected void |
finalize() |
String |
getContentType()
Returns the content type of this data source.
|
InputStream |
getInputStream()
Returns a new input stream on this data source.
|
String |
getName()
This method always returns null.
|
OutputStream |
getOutputStream()
This method always returns null.
|
public SwapableMemoryDataSource(InputStream inputStream, String contentType) throws IOException
SwapableMemoryDataSource
from inputStream, and contentType.
The instance then reads from the input stream, and stores it in memory unless the size
of the content is larger that 64KB, at whichpoint the stream is stored in a temporary
file on disk.inputStream
- the stream to read fromcontentType
- the content type of this streamIOException
public SwapableMemoryDataSource(InputStream inputStream, String contentType, int maxMemorySize) throws IOException
SwapableMemoryDataSource
from inputStream, and
contentType. The instance then reads from the input stream, and stores it
in memory unless the size of the content is larger than maxMemorySize, at
whichpoint the stream is stored in a temporary file on disk.inputStream
- the stream to read fromcontentType
- the content type of this streammaxMemorySize
- the maximum size in bytes that this data source is
allowed to allocate for stream storageIOException
protected void finalize() throws Throwable
public void cleanup()
public String getContentType()
getContentType
in interface DataSource
public InputStream getInputStream() throws IOException
getInputStream
in interface DataSource
IOException
public String getName()
getName
in interface DataSource
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface DataSource
IOException
Copyright © 2012 JBoss, by Red Hat. All Rights Reserved.