com.tffenterprises.music.tag.id3v2
Class Flags_2_0

java.lang.Object
  extended by com.tffenterprises.music.tag.id3v2.Flags
      extended by com.tffenterprises.music.tag.id3v2.Flags_2_0
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

 class Flags_2_0
extends Flags
implements java.io.Serializable, java.lang.Cloneable

Flags_2_0 implements the flags for version 2.0 of ID3v2 (aka ID3v2.2.0). This class also works for experimental tags of version 2.1.

Version:
1.0d1 $Date: 2003/03/16 18:52:29 $
Author:
Guillaume Lessard

Nested Class Summary
 
Nested classes/interfaces inherited from class com.tffenterprises.music.tag.id3v2.Flags
Flags.InputProcessingStream
 
Field Summary
static byte TAG_COMPRESSION_FLAG
          Flag bit for extended header presence.
 
Fields inherited from class com.tffenterprises.music.tag.id3v2.Flags
DEFAULT, EXPERIMENTAL_FLAG, UNSYNCHRONIZATION_FLAG
 
Constructor Summary
protected Flags_2_0()
          Default constructor.
protected Flags_2_0(byte flags)
          Constructs a Flags_2_0 object with the given flags.
 
Method Summary
 void checkVersion()
          Asserts that the object's assigned version number is compatible.
 boolean isIncompatible()
          Returns whether the tag has the incompatible (tag compression) flag turned on.
 java.io.InputStream processInput(java.io.InputStream in)
          Processes the InputStream in which the ID3v2 information is embedded, and return an InputStream that will correctly read the tag given the flags.
 java.io.OutputStream processOutput(java.io.OutputStream out)
          Process the OutputStream in which the ID3v2 tag is to be embedded.
 boolean usesTagCompression()
          Returns whether these flags indicate the use of tag compression.
 
Methods inherited from class com.tffenterprises.music.tag.id3v2.Flags
check, clone, equals, getChecksum, getFlags, getNewInstance, getNewInstance, getNewInstance, getVersion, hashCode, isChanged, isMarkedExperimental, processUnsynchronization, set, setChanged, setFlags, toString, unset, updateChecksum, usesUnsynchronization
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_COMPRESSION_FLAG

public static final byte TAG_COMPRESSION_FLAG
Flag bit for extended header presence.

See Also:
Constant Field Values
Constructor Detail

Flags_2_0

protected Flags_2_0()
Default constructor. Constructs a Flags_2_0 object with zeroed flags. This should not be called by normal users of Flags objects. Use the factory method newInstance() instead.


Flags_2_0

protected Flags_2_0(byte flags)
Constructs a Flags_2_0 object with the given flags. This should not be called by normal users of Flags objects. Use the factory method newInstance() instead.

Parameters:
flags - the flags used to initialize the object.
Method Detail

usesTagCompression

public boolean usesTagCompression()
Returns whether these flags indicate the use of tag compression. Note that tag compression was undefined in ID3v2.2.0, and was redefined as incompatible in ID3v2.2.1.

Returns:
whether these flags indicate the use of tag compression.

isIncompatible

public boolean isIncompatible()
Returns whether the tag has the incompatible (tag compression) flag turned on.

Returns:
true if the tag has the incompatible flag turned on.

checkVersion

public void checkVersion()
                  throws TagDataFormatException
Asserts that the object's assigned version number is compatible.

Specified by:
checkVersion in class Flags
Throws:
TagDataFormatException - if the version is not compatible.

processInput

public java.io.InputStream processInput(java.io.InputStream in)
                                 throws java.io.IOException,
                                        TagDataFormatException
Processes the InputStream in which the ID3v2 information is embedded, and return an InputStream that will correctly read the tag given the flags. If the tag reports that it uses compression, throw an exception.

Overrides:
processInput in class Flags
Parameters:
in - the InputStream in which the ID3v2 information is embedded.
Returns:
an InputStream which will correctly process the tag..
Throws:
TagDataFormatException - if the stream contains a malformed or otherwise incompatible tag, or some erroneous parameters.
java.io.IOException - if an I/O error occurs.

processOutput

public java.io.OutputStream processOutput(java.io.OutputStream out)
Process the OutputStream in which the ID3v2 tag is to be embedded. This method is called by ID3v2 when writing the tag to a file or stream.

This method applies a FilterOutputStream which processes any necessary unsynchronization for the tag, and makes sure the compression flag is not set.

Overrides:
processOutput in class Flags
Parameters:
out - the OutputStream to which the ID3v2 tag will be written
Returns:
the OutputStream to which the ID3v2 tag will be written