public ReplacingInputStream( InputStream in,
				 Map<byte[],byte[]> replacementMap 
				 ) 
	throws NullPointerException {

	super();

	if( in == null )
	    throw new NullPointerException( "Cannot create ReplacingInputStreams from null-streams." );
	if( replacementMap == null )
	    throw new NullPointerException( "Cannot create ReplacingInputStreams with null-map." );

	// Convert key set to list
	List<byte[]> keyList         = new ArrayList<byte[]>( replacementMap.size() );

	Iterator<Map.Entry<byte[],byte[]>> iter = replacementMap.entrySet().iterator();
	while( iter.hasNext() ) {
	    
	    Map.Entry<byte[],byte[]> entry = iter.next();
	    byte[] key   = entry.getKey();
	    byte[] value = entry.getValue();

	    if( key == null )
		throw new NullPointerException( "Cannot create ReplacingInputStreams with null-keys." );
	    if( value == null )
		throw new NullPointerException( "Cannot create ReplacingInputStreams with null-replacements." );

	    keyList.add( key );
	}

	this.multiIn        = new MultiStopMarkInputStream( in, keyList );
	this.replacementMap = replacementMap;
    }