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
DataSourcedefault method implementations.- Author:
- Allen D. Ball
-
-
Field Summary
Fields Modifier and Type Field Description static StringAPPLICATION_OCTET_STREAMRFC2045 "application/octet-stream"static StringAPPLICATION_XMLRFC3023 "application/xml"static StringCONTENT_TYPERFC2045 "Content-Type"static StringTEXT_HTMLRFC2045 "text/html"static StringTEXT_PLAINRFC2045 "text/plain"
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidclear()Method to clear theDataSourceand discard any input on any opengetOutputStream().default InputStreamgetInputStream()default InputStreamgetInputStream(Class<?>... types)default OutputStreamgetOutputStream()default OutputStreamgetOutputStream(Class<?>... types)default longlength()Method to get the number of bytes stored inthisDataSource.default voidsetContentType(String type)default voidsetName(String name)default InputStreamwrap(InputStream in, Class<?>... types)Method to "wrap" anInputStreamintoInputStreaminstances.default OutputStreamwrap(OutputStream out, Class<?>... types)Method to "wrap" anOutputStreamintoOutputStreaminstances.-
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:
getInputStreamin interfaceDataSource- Throws:
UnsupportedOperationException- Unless overridden by subclass implementation.IOException
-
getOutputStream
default OutputStream getOutputStream() throws IOException
- Specified by:
getOutputStreamin interfaceDataSource- Throws:
UnsupportedOperationException- Unless overridden by subclass implementation.IOException
-
clear
default void clear()
Method to clear theDataSourceand discard any input on any opengetOutputStream().- Throws:
UnsupportedOperationException- IfgetOutputStream()throwsUnsupportedOperationException.
-
length
default long length()
- Returns:
- The number of bytes stored in
thisDataSource;-1if the count is unknown.
-
getInputStream
default InputStream getInputStream(Class<?>... types) throws IOException
- Parameters:
types- TheInputStreamimplementationClasses.- Returns:
- The "wrapped"
InputStream. - Throws:
IOException- If an I/O error occurs.
-
getOutputStream
default OutputStream getOutputStream(Class<?>... types) throws IOException
- Parameters:
types- TheOutputStreamimplementationClasses.- 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" anInputStreamintoInputStreaminstances.- Parameters:
in- TheInputStream.types- TheInputStreamimplementationClasses.- 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" anOutputStreamintoOutputStreaminstances.- Parameters:
out- TheOutputStream.types- TheOutputStreamimplementationClasses.- Returns:
- The "wrapped"
OutputStream. - Throws:
IOException- If any of the wrapping streams throw anIOException.
-
-