public interface DataSourceDefaultMethods extends DataSource
DataSource default method implementations.| Modifier and Type | Field and 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"
|
| Modifier and Type | Method and Description |
|---|---|
default void |
clear()
Method to clear the
DataSource and discard any input on any
open getOutputStream(). |
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 in
this
DataSource. |
default void |
setContentType(String type) |
default void |
setName(String name) |
default InputStream |
wrap(InputStream in,
Class<?>... types)
Method to "wrap" an
InputStream into InputStream
instances. |
default OutputStream |
wrap(OutputStream out,
Class<?>... types)
Method to "wrap" an
OutputStream into OutputStream
instances. |
default void |
writeTo(OutputStream out)
Method to write the contents of this
DataSource to an
OutputStream. |
getContentType, getNamestatic final String CONTENT_TYPE
static final String APPLICATION_OCTET_STREAM
static final String APPLICATION_XML
static final String TEXT_PLAIN
static final String TEXT_HTML
default void setContentType(String type)
default InputStream getInputStream() throws IOException
getInputStream in interface DataSourceUnsupportedOperationException - Unless overridden by subclass
implementation.IOExceptiondefault OutputStream getOutputStream() throws IOException
getOutputStream in interface DataSourceUnsupportedOperationException - Unless overridden by subclass
implementation.IOExceptiondefault void clear()
DataSource and discard any input on any
open getOutputStream().UnsupportedOperationException - If getOutputStream() throws
UnsupportedOperationException.default long length()
this
DataSource; -1 if the count is unknown.default InputStream getInputStream(Class<?>... types) throws IOException
types - The InputStream implementation
Classes.InputStream.IOException - If an I/O error occurs.default OutputStream getOutputStream(Class<?>... types) throws IOException
types - The OutputStream implementation
Classes.OutputStream.IOException - If an I/O error occurs.default void writeTo(OutputStream out) throws IOException
DataSource to an
OutputStream.out - The target OutputStream.IOException - If a problem is encountered opening or
reading the InputStream or writing
to the OutputStream.getInputStream()default InputStream wrap(InputStream in, Class<?>... types) throws IOException
InputStream into InputStream
instances.in - The InputStream.types - The InputStream implementation
Classes.InputStream.IOException - If any of the wrapping streams throw an
IOException.default OutputStream wrap(OutputStream out, Class<?>... types) throws IOException
OutputStream into OutputStream
instances.out - The OutputStream.types - The OutputStream implementation
Classes.OutputStream.IOException - If any of the wrapping streams throw an
IOException.Copyright © 2015–2020 Allen D. Ball. All rights reserved.