FileDocCategorySizeDatePackage
MetadataContainerFactory.javaAPI DocJaudiotagger 2.0.42921Wed Mar 30 16:11:50 BST 2011org.jaudiotagger.audio.asf.data

MetadataContainerFactory

public final class MetadataContainerFactory extends Object
A factory for creating appropriate {@link MetadataContainer} objects upon specified {@linkplain ContainerType container types}.
author
Christian Laireiter

Fields Summary
private static final MetadataContainerFactory
INSTANCE
Factory instance.
Constructors Summary
private MetadataContainerFactory()
Hidden utility class constructor.

        // Hidden
    
Methods Summary
public MetadataContainercreateContainer(ContainerType type)
Creates an appropriate {@linkplain MetadataContainer container implementation} for the given container type.

param
type the type of container to get a container instance for.
return
appropriate container implementation.

        return createContainer(type, 0, BigInteger.ZERO);
    
public MetadataContainercreateContainer(ContainerType type, long pos, java.math.BigInteger chunkSize)
Convenience Method for I/O. Same as {@link #createContainer(ContainerType)}, but additionally assigns position and size. (since a {@link MetadataContainer} is actually a {@link Chunk}).

param
type The containers type.
param
pos the position within the stream.
param
chunkSize the size of the container.
return
an appropriate container implementation with assigned size and position.

        MetadataContainer result;
        if (type == ContainerType.CONTENT_DESCRIPTION) {
            result = new ContentDescription(pos, chunkSize);
        } else if (type == ContainerType.CONTENT_BRANDING) {
            result = new ContentBranding(pos, chunkSize);
        } else {
            result = new MetadataContainer(type, pos, chunkSize);
        }
        return result;
    
public MetadataContainer[]createContainers(ContainerType[] types)
Convenience method which calls {@link #createContainer(ContainerType)} for each given container type.

param
types types of the container which are to be created.
return
appropriate container implementations.

        assert types != null;
        final MetadataContainer[] result = new MetadataContainer[types.length];
        for (int i = 0; i < result.length; i++) {
            result[i] = createContainer(types[i]);
        }
        return result;
    
public static org.jaudiotagger.audio.asf.data.MetadataContainerFactorygetInstance()
Returns an instance.

return
an instance.


                
        
        return INSTANCE;