Logo Search packages:      
Sourcecode: f-spot version File versions  Download package

void TagLib::Id3v2::Tag::Read ( File  file,
long  position 
) [inline, protected]

Populates the current instance be reading in a tag from a specified position in a specified file.

Parameters:
fileA File object to read the tag from.
positionA long value specifying the seek position at which to read the tag.
Exceptions:
ArgumentNullExceptionfile is .
ArgumentOutOfRangeExceptionposition is less than 0 or greater than the size of the file.

Definition at line 795 of file Tag.cs.

References TagLib::File::Length, TagLib::File::Mode, TagLib::File::ReadBlock(), TagLib::File::Seek(), and TagLib::Id3v2::Header::Size.

            {
                  if (file == null)
                        throw new ArgumentNullException ("file");
                  
                  file.Mode = File.AccessMode.Read;
                  
                  if (position < 0 || position > file.Length - Header.Size)
                        throw new ArgumentOutOfRangeException (
                              "position");
                  
                  file.Seek (position);
                  
                  header = new Header (file.ReadBlock ((int) Header.Size));
                  
                  // If the tag size is 0, then this is an invalid tag.
                  // Tags must contain at least one frame.
                  
                  if(header.TagSize == 0)
                        return;
                  
                  Parse (file.ReadBlock ((int) header.TagSize));
            }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index