public interface DetectorStream
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.
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. done
). 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 disposed by the garbage
collector.DetectorStreamProvider
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getMetadata()
This method gets the context with the detected metadata.
|
boolean |
isDone()
This method determines if the detection is done.
|
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.Copyright © 2001–2016 mmm-Team. All rights reserved.