org.jaudiotagger.audio.asf.io
Class AsfExtHeaderModifier

java.lang.Object
  extended by org.jaudiotagger.audio.asf.io.AsfExtHeaderModifier
All Implemented Interfaces:
ChunkModifier

public class AsfExtHeaderModifier
extends java.lang.Object
implements ChunkModifier

This modifier manipulates an ASF header extension object.

Author:
Christian Laireiter

Field Summary
private  java.util.List<ChunkModifier> modifierList
          List of modifiers which are to be applied to contained chunks.
 
Constructor Summary
AsfExtHeaderModifier(java.util.List<ChunkModifier> modifiers)
          Creates an instance.
 
Method Summary
private  void copyChunk(GUID guid, java.io.InputStream source, java.io.OutputStream destination)
          Simply copies a chunk from source to destination.
The method assumes, that the GUID has already been read and will write the provided one to the destination.
The chunk length however will be read and used to determine the amount of bytes to copy.
 boolean isApplicable(GUID guid)
          Determines, whether the modifier handles chunks identified by given guid.
 ModificationResult modify(GUID guid, java.io.InputStream source, java.io.OutputStream destination)
          Writes a modified copy of the chunk into the destination..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modifierList

private final java.util.List<ChunkModifier> modifierList
List of modifiers which are to be applied to contained chunks.

Constructor Detail

AsfExtHeaderModifier

public AsfExtHeaderModifier(java.util.List<ChunkModifier> modifiers)
Creates an instance.

Parameters:
modifiers - modifiers to apply.
Method Detail

copyChunk

private void copyChunk(GUID guid,
                       java.io.InputStream source,
                       java.io.OutputStream destination)
                throws java.io.IOException
Simply copies a chunk from source to destination.
The method assumes, that the GUID has already been read and will write the provided one to the destination.
The chunk length however will be read and used to determine the amount of bytes to copy.

Parameters:
guid - GUID of the current CHUNK.
source - source of an ASF chunk, which is to be located at the chunk length field.
destination - the destination to copy the chunk to.
Throws:
java.io.IOException - on I/O errors.

isApplicable

public boolean isApplicable(GUID guid)
Determines, whether the modifier handles chunks identified by given guid.

Specified by:
isApplicable in interface ChunkModifier
Parameters:
guid - GUID to test.
Returns:
true, if this modifier can be used to modify the chunk.

modify

public ModificationResult modify(GUID guid,
                                 java.io.InputStream source,
                                 java.io.OutputStream destination)
                          throws java.io.IOException
Writes a modified copy of the chunk into the destination..

Specified by:
modify in interface ChunkModifier
Parameters:
guid - GUID of the chunk to modify.
source - a stream providing the chunk, starting at the chunks length field.
destination - destination for the modified chunk.
Returns:
the differences between source and destination.
Throws:
java.io.IOException - on I/O errors.