DataHandler extended to offer better buffer management
in a streaming environment.
DataHandler is used commonly as a data format across
multiple systems (such as JAXB/WS.) Unfortunately, DataHandler
has the semantics of "read as many times as you want", so this makes
it difficult for involving parties to handle a BLOB in a streaming fashion.
StreamingDataHandler solves this problem by offering methods
that enable faster bulk "consume once" read operation.
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | |
| public String | |
| public abstract void | |
| public abstract InputStream | Returns: always non-null. Represents the content of this BLOB. The returned stream is generally not buffered, so for better performance read in a big batch or wrap this intoBufferedInputStream.Works like |
| public void |
| hrefCid | back to summary |
|---|---|
| private String hrefCid | |
| StreamingDataHandler | back to summary |
|---|---|
| public StreamingDataHandler(Object o, String s) | |
| StreamingDataHandler | back to summary |
|---|---|
| public StreamingDataHandler(URL url) | |
| StreamingDataHandler | back to summary |
|---|---|
| public StreamingDataHandler(DataSource dataSource) | |
| close | back to summary |
|---|---|
| public abstract void close() throws IOException Redeclares java. Releases any resources associated with this DataHandler. (such as an attachment in a web service read from a temp file will be deleted.) After calling this method, it is illegal to call any other methods.
| |
| getHrefCid | back to summary |
|---|---|
| public String getHrefCid() | |
| moveTo | back to summary |
|---|---|
| public abstract void moveTo(File dst) throws IOException Obtains the BLOB into a specified file. Semantically, this method is roughly equivalent to the following code, except that the actual implementation is likely to be a lot faster. InputStream i = getInputStream(); OutputStream o = new FileOutputStream(dst); int ch; while((ch=i.read())!=-1) o.write(ch); i.close(); o.close();
The main motivation behind this method is that often
This method shouldn't be called when there are any open streams.
After this method is invoked,
| |
| readOnce | back to summary |
|---|---|
| public abstract InputStream readOnce() throws IOException Works like
This is used as a signal from the caller that there will
be no further
When
Note that it is legal to call
| |
| setHrefCid | back to summary |
|---|---|
| public void setHrefCid(final String cid) | |