Package ball.activation
Interface DataSourceDefaultMethods
-
- All Superinterfaces:
DataSource
- All Known Implementing Classes:
AbstractDataSource
,ByteArrayDataSource
,FilterDataSource
,JAXBDataSource
,ReaderWriterDataSource
,TempFileDataSource
,TextTable
,ThrowableDataSource
public interface DataSourceDefaultMethods extends DataSource
DataSource
default method implementations.- Author:
- Allen D. Ball
-
-
Field Summary
Fields Modifier and Type Field Description static String
APPLICATION_OCTET_STREAM
RFC2045 "application/octet-stream"static String
APPLICATION_XML
RFC3023 "application/xml"static String
CONTENT_TYPE
RFC2045 "Content-Type"static String
TEXT_HTML
RFC2045 "text/html"static String
TEXT_PLAIN
RFC2045 "text/plain"
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
clear()
Method to clear theDataSource
and discard any input on any opengetOutputStream()
.default InputStream
getInputStream()
default InputStream
getInputStream(Class<?>... types)
default OutputStream
getOutputStream()
default OutputStream
getOutputStream(Class<?>... types)
default long
length()
Method to get the number of bytes stored inthis
DataSource
.default void
setContentType(String type)
default void
setName(String name)
default InputStream
wrap(InputStream in, Class<?>... types)
Method to "wrap" anInputStream
intoInputStream
instances.default OutputStream
wrap(OutputStream out, Class<?>... types)
Method to "wrap" anOutputStream
intoOutputStream
instances.-
Methods inherited from interface javax.activation.DataSource
getContentType, getName
-
-
-
-
Field Detail
-
CONTENT_TYPE
static final String CONTENT_TYPE
RFC2045 "Content-Type"- See Also:
- Constant Field Values
-
APPLICATION_OCTET_STREAM
static final String APPLICATION_OCTET_STREAM
RFC2045 "application/octet-stream"- See Also:
- Constant Field Values
-
APPLICATION_XML
static final String APPLICATION_XML
RFC3023 "application/xml"- See Also:
- Constant Field Values
-
TEXT_PLAIN
static final String TEXT_PLAIN
RFC2045 "text/plain"- See Also:
- Constant Field Values
-
TEXT_HTML
static final String TEXT_HTML
RFC2045 "text/html"- See Also:
- Constant Field Values
-
-
Method Detail
-
setContentType
default void setContentType(String type)
-
getInputStream
default InputStream getInputStream() throws IOException
- Specified by:
getInputStream
in interfaceDataSource
- Throws:
UnsupportedOperationException
- Unless overridden by subclass implementation.IOException
-
getOutputStream
default OutputStream getOutputStream() throws IOException
- Specified by:
getOutputStream
in interfaceDataSource
- Throws:
UnsupportedOperationException
- Unless overridden by subclass implementation.IOException
-
clear
default void clear()
Method to clear theDataSource
and discard any input on any opengetOutputStream()
.- Throws:
UnsupportedOperationException
- IfgetOutputStream()
throwsUnsupportedOperationException
.
-
length
default long length()
- Returns:
- The number of bytes stored in
this
DataSource
;-1
if the count is unknown.
-
getInputStream
default InputStream getInputStream(Class<?>... types) throws IOException
- Parameters:
types
- TheInputStream
implementationClass
es.- Returns:
- The "wrapped"
InputStream
. - Throws:
IOException
- If an I/O error occurs.
-
getOutputStream
default OutputStream getOutputStream(Class<?>... types) throws IOException
- Parameters:
types
- TheOutputStream
implementationClass
es.- Returns:
- The "wrapped"
OutputStream
. - Throws:
IOException
- If an I/O error occurs.
-
wrap
default InputStream wrap(InputStream in, Class<?>... types) throws IOException
Method to "wrap" anInputStream
intoInputStream
instances.- Parameters:
in
- TheInputStream
.types
- TheInputStream
implementationClass
es.- Returns:
- The "wrapped"
InputStream
. - Throws:
IOException
- If any of the wrapping streams throw anIOException
.
-
wrap
default OutputStream wrap(OutputStream out, Class<?>... types) throws IOException
Method to "wrap" anOutputStream
intoOutputStream
instances.- Parameters:
out
- TheOutputStream
.types
- TheOutputStream
implementationClass
es.- Returns:
- The "wrapped"
OutputStream
. - Throws:
IOException
- If any of the wrapping streams throw anIOException
.
-
-