|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DetectorStream
This is the abstract base interface for a container of a wrapped stream
together with metadata that is detected while streaming the data.
If a reasonable application transfers data from a source to a sink it does
NOT load the entire data into memory but uses streams (
InputStream and OutputStream). A typical
example is a file that is uploaded via HTTP and written into a database. In
many situations it is desirable to get metadata (e.g. mimetype, md5sum, etc.)
about the actual data. Most solutions to detect metadata need random access
to seek in the data. Therefore you would need to save the data to a temporary
file, analyze it and then transfer the file to the database.
The DetectorStream allows you to get the metadata on the fly while
streaming that data. All you need to do is to create a wrapper on your stream
and perform your actual transfer on the wrapper stream instead. This
interface is the container for the wrapper stream.
This approach requires that you read/write your data completely (at least
until the detection is done).
A DetectorStream is typically used to get the actual wrapper stream,
read/write the stream data and then get the metadata.
After this, the object is useless and can be eaten up by the garbage
collector.
DetectorStreamProvider| Method Summary | |
|---|---|
Map<String,Object> |
getMetadata()
This method gets the context with the detected metadata. |
boolean |
isDone()
This method determines if the detection is done. |
| Method Detail |
|---|
Map<String,Object> getMetadata()
done.Map have a look at
net.sf.mmm.util.metakey.api.MetakeyCore.
boolean isDone()
true.
However the detection may be done before the end of the stream was reached
(e.g. because all metadata comes from the header of
the data).
true if the metadata has been completely been
collected, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||