C# Class Achamenes.ID3.TagHeader

Encapsulates the 10 byte long header of an ID3 v2 tag.
Datei anzeigen Open project: sahands/a-id3 Class Usage Examples

Public Methods

Method Description
FromStream ( System stream ) : TagHeader

Reads the ID3 v2 header from a stream.

The method returns null if it can not find a valid ID3 v2 tag in the file. This means that in case of a corrupt ID3 v2 header, (e.g. invalid tag size), null is returned. This method can therefore be used to check a file for the existence of a valid ID3 v2 tag. NOTE: Valid in this context does not mean of compatible version or having compatible flags.

TagHeader ( byte majorVersion, byte minorVersion, TagHeaderFlags flags, int tagSize ) : System

Constructs a new TagHeader object representing an ID3 v2 header.

WriteToStream ( System stream ) : void

Writes the ID3 v2 header to a given stream.

Method Details

FromStream() public static method

Reads the ID3 v2 header from a stream.
The method returns null if it can not find a valid ID3 v2 tag in the file. This means that in case of a corrupt ID3 v2 header, (e.g. invalid tag size), null is returned. This method can therefore be used to check a file for the existence of a valid ID3 v2 tag. NOTE: Valid in this context does not mean of compatible version or having compatible flags.
/// The passed stream was null. /// /// There was an IO exception while trying to read the header. /// /// The stream does not support reading. /// /// The passed stream was closed before the method was called. ///
public static FromStream ( System stream ) : TagHeader
stream System The stream to read the header from.
return TagHeader

TagHeader() public method

Constructs a new TagHeader object representing an ID3 v2 header.
/// The given tagSize was too large. ///
public TagHeader ( byte majorVersion, byte minorVersion, TagHeaderFlags flags, int tagSize ) : System
majorVersion byte The major version of the ID3 tag (e.g. 3 for ID3v2.3)
minorVersion byte The minor version of the ID3 tag
flags TagHeaderFlags The flag bits
tagSize int The total size of the tag (excluding the header itself)
return System

WriteToStream() public method

Writes the ID3 v2 header to a given stream.
/// The passed stream was null. /// /// There was an IO exception while trying to write the header. /// /// The stream does not support writing. /// /// The passed stream was closed before the method was called. ///
public WriteToStream ( System stream ) : void
stream System The stream to write the header to.
return void