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

string TagLib::ByteVector::ToString ( StringType  type,
int  offset,
int  count 
) [inline, inherited]

Converts a portion of the current instance to a string object using a specified encoding.

Parameters:
type A StringType value indicating the encoding to use when converting to a string object.
offset A int value specify the index in the current instance at which to start converting.
count A int value specify the number of bytes to convert.
Returns:
A string object containing the converted text.
Exceptions:
ArgumentOutOfRangeException offset is less than zero or greater than the total number of bytes, or count is less than zero or greater than the number of bytes after offset .

Definition at line 1290 of file ByteVector.cs.

References TagLib::ByteVector::Count, TagLib::ByteVector::Data, TagLib::ByteVector::data, TagLib::ByteVector::Mid(), and TagLib::ByteVector::StringTypeToEncoding().

Referenced by TagLib::Png::File::CheckCRC(), TagLib::IFD::IFDReader::CreateIFDEntry(), TagLib::IFD::IFDReader::FixupDirectory(), TagLib::Id3v2::Tag::GetUfidText(), TagLib::Riff::List< TagLib::ICodec >::GetValuesAsStrings(), TagLib::Mpeg4::IsoHandlerBox::IsoHandlerBox(), TagLib::Riff::DivXTag::Parse(), TagLib::Ogg::XiphComment::Parse(), TagLib::Id3v1::StringHandler::Parse(), TagLib::Ape::Item::Parse(), TagLib::Id3v2::UnsynchronisedLyricsFrame::ParseFields(), TagLib::Id3v2::TermsOfUseFrame::ParseFields(), TagLib::Id3v2::SynchronisedLyricsFrame::ParseFields(), TagLib::Id3v2::RelativeVolumeFrame::ParseFields(), TagLib::Id3v2::PopularimeterFrame::ParseFields(), TagLib::Id3v2::GeneralEncapsulatedObjectFrame::ParseFields(), TagLib::Id3v2::CommentsFrame::ParseFields(), TagLib::Id3v2::TextInformationFrame::ParseRawData(), TagLib::Flac::Picture::Picture(), TagLib::Asf::Tag::PictureFromData(), TagLib::Riff::File::Read(), TagLib::Tiff::Cr2::File::ReadAdditionalCR2Header(), TagLib::Jpeg::File::ReadAPP1Segment(), TagLib::Gif::File::ReadApplicationExtensionBlock(), TagLib::Jpeg::File::ReadCOMSegment(), TagLib::Tiff::BaseTiffFile::ReadHeader(), TagLib::Gif::File::ReadHeader(), TagLib::Png::File::ReadiTXtChunk(), TagLib::Png::File::ReadMetadata(), TagLib::Png::File::ReadTerminatedString(), TagLib::Png::File::ReadtEXtChunk(), TagLib::Asf::File::ReadUnicode(), TagLib::Png::File::ReadzTXtChunk(), TagLib::Id3v2::Tag::SetNumberFrame(), and TagLib::IFD::Entries::UserCommentIFDEntry::UserCommentIFDEntry().

            {
                  if (offset < 0 || offset > Count)
                        throw new ArgumentOutOfRangeException ("offset");
                  
                  if (count < 0 || count + offset > Count)
                        throw new ArgumentOutOfRangeException ("count");
                  
                  ByteVector bom = type == StringType.UTF16 &&
                        this.data.Count - offset > 1 ? Mid (offset, 2) : null;
                  
                  string s = StringTypeToEncoding (type, bom)
                        .GetString (Data, offset, count);
                  
                  // UTF16 BOM
                  if(s.Length != 0 && (s[0] == 0xfffe || s[0] == 0xfeff)) 
                        return s.Substring (1);
                  
                  return s;
            }


Generated by  Doxygen 1.6.0   Back to index