public class EmptyDataSource extends java.lang.Object implements SizeAwareDataSource
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
contentType |
private static java.io.InputStream |
emptyInputStream |
static EmptyDataSource |
INSTANCE
Empty data source instance with content type application/octet-stream.
|
| Constructor and Description |
|---|
EmptyDataSource(java.lang.String contentType)
Construct an empty data source with the given content type.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getContentType() |
java.io.InputStream |
getInputStream() |
java.lang.String |
getName() |
java.io.OutputStream |
getOutputStream() |
long |
getSize()
Get the size of the data source.
|
public static final EmptyDataSource INSTANCE
private static final java.io.InputStream emptyInputStream
private final java.lang.String contentType
public EmptyDataSource(java.lang.String contentType)
contentType - the content typepublic java.lang.String getContentType()
getContentType in interface javax.activation.DataSourcepublic java.lang.String getName()
getName in interface javax.activation.DataSourcepublic long getSize()
SizeAwareDataSourceDataSource.getInputStream() before reaching
the end of the stream. If the implementation is unable to determine the
size, it must return -1.getSize in interface SizeAwareDataSourcepublic 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.IOException