net.sf.mmm.util.io.impl
Class DetectorStreamProviderImpl

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.io.base.AbstractDetectorStreamProvider
              extended by net.sf.mmm.util.io.impl.DetectorStreamProviderImpl
All Implemented Interfaces:
DetectorStreamProvider

public class DetectorStreamProviderImpl
extends AbstractDetectorStreamProvider

This is the implementation of the DetectorStreamProvider interface.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Constructor Summary
DetectorStreamProviderImpl()
          The constructor.
 
Method Summary
 DetectorInputStream wrapInputStream(InputStream stream, Map<String,Object> metadata)
          This method gets a DetectorInputStream that wraps the given stream.
 DetectorOutputStream wrapOutputStream(OutputStream stream, Map<String,Object> metadata)
          This method gets a DetectorOutputStream that wraps the given stream.
 
Methods inherited from class net.sf.mmm.util.io.base.AbstractDetectorStreamProvider
addProcessorFactory, doInitialize, getByteArrayPool, getProcessorFactoryList, setByteArrayPool, setProcessorFactoryList, wrapInputStream, wrapOutputStream
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DetectorStreamProviderImpl

public DetectorStreamProviderImpl()
The constructor.

Method Detail

wrapInputStream

public DetectorInputStream wrapInputStream(InputStream stream,
                                           Map<String,Object> metadata)
This method gets a DetectorInputStream that wraps the given stream. In addition to DetectorStreamProvider.wrapInputStream(InputStream) an additional parameter metadata is supplied. If this context contains metadata values, that are mutable, the stream wrapper manipulates the data such that the given values correspond to the data.
E.g. if the metadata contains a title and a genre and the stream points to the data of an mp3 song, the given title and genre are "written" to the ID3 tag of the song (if supported by the implementation).
If the metadata contains values that are immutable and NOT compatible with the detected values (e.g. mimetype=text/plain is supplied, but mimetype is audio/midi) then the value will simple be overridden in the detected metadata.
If the metadata contains values that are unknown to the detector implementation (e.g. foo=bar), these values will also be untouched and are also available in the detected metadata.

Parameters:
stream - is the stream to wrap. This stream must be a fresh stream that is untouched since it was opened.
metadata - is the existing metadata to apply.
Returns:
the wrapped input stream.

wrapOutputStream

public DetectorOutputStream wrapOutputStream(OutputStream stream,
                                             Map<String,Object> metadata)
This method gets a DetectorOutputStream that wraps the given stream. In addition to DetectorStreamProvider.wrapOutputStream(OutputStream) an additional parameter metadata is supplied. If this context contains metadata values, that are mutable, the stream wrapper manipulates the data such that the given values correspond to the data.
E.g. if the metadata contains a title and a genre and the stream points to the data of an mp3 song, the given title and genre are written to the ID3 tag of the song (if supported by the implementation).
If the metadata contains values that are immutable and NOT compatible with the detected values (e.g. mimetype=text/plain is supplied, but mimetype is audio/midi) then the value will simple be overridden in the detected metadata.
If the metadata contains values that are unknown to the detector implementation (e.g. foo=bar), these values will also be untouched and are also available in the detected metadata.

Parameters:
stream - is the stream to wrap. This stream must be a fresh stream that is untouched since it was opened.
metadata - is the existing metadata to apply.
Returns:
the wrapped output stream.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.