Class: TagLib::File
- Inherits:
-
Object
- Object
- TagLib::File
- Defined in:
- lib/TagLib_doc.rb
Overview
A file class with some useful methods for tag manipulation. .
This class is a basic file class with some methods that are particularly useful for tag editors. It has methods to take advantage of ByteVector and a binary search method for finding patterns in a file.
Direct Known Subclasses
TagLib::FLAC::File, MPC::File, MPEG::File, Ogg::File, TrueAudio::File, WavPack::File
Instance Method Summary collapse
-
#audioProperties ⇒ Object
Returns a pointer to this file's audio properties.
-
#clear ⇒ Object
Reset the end-of-file and error flags on the file.
- #find1 ⇒ Object
- #find2 ⇒ Object
- #find3 ⇒ Object
-
#insert(data, start = 0, replace = 0) ⇒ Object
Insert data at position start in the file overwriting replace bytes of the original content.This method is slow since it requires rewriting all of the file after the insertion point.
-
#isOpen ⇒ Object
Since the file can currently only be opened as an argument to the constructor (sort-of by design), this returns if that open succeeded.
-
#isValid ⇒ Object
Returns true if the file is open and readble and valid information for the Tag and / or AudioProperties was found.
- #isWritable ⇒ Object
-
#length ⇒ Object
Returns the length of the file.
-
#name ⇒ Object
Returns the file name in the local file system encoding.
- #open? ⇒ Boolean
- #read_only? ⇒ Boolean
-
#readBlock(length) ⇒ Object
Reads a block of size length at the current get pointer.
-
#readOnly ⇒ Object
Returns true if the file is read only (or if the file can not be opened).
-
#removeBlock(start = 0, length = 0) ⇒ Object
Removes a block of the file starting a start and continuing for length bytes.This method is slow since it involves rewriting all of the file after the removed portion.
-
#rfind(pattern, fromOffset = 0, before = ByteVector::null) ⇒ Object
Returns the offset in the file that pattern occurs at or -1 if it can not be found.
-
#save ⇒ Object
Save the file and its associated tags.
-
#seek(offset, p = Beginning) ⇒ Object
Move the I/O pointer to offset in the file from position p.
-
#tag ⇒ Object
Returns a pointer to this file's tag.
-
#tell ⇒ Object
Returns the current offset withing the file.
- #valid? ⇒ Boolean
- #writable? ⇒ Boolean
-
#writeBlock(data) ⇒ Object
Attempts to write the block data at the current get pointer.
Instance Method Details
#audioProperties ⇒ Object
Returns a pointer to this file's audio properties. This should be reimplemented in the concrete subclasses. If no audio properties were read then this will return a null pointer.
403 404 |
# File 'lib/TagLib_doc.rb', line 403 def audioProperties() end |
#clear ⇒ Object
Reset the end-of-file and error flags on the file.
359 360 |
# File 'lib/TagLib_doc.rb', line 359 def clear() end |
#find1 ⇒ Object
387 388 |
# File 'lib/TagLib_doc.rb', line 387 def find1() end |
#find2 ⇒ Object
410 411 |
# File 'lib/TagLib_doc.rb', line 410 def find2() end |
#find3 ⇒ Object
336 337 |
# File 'lib/TagLib_doc.rb', line 336 def find3() end |
#insert(data, start = 0, replace = 0) ⇒ Object
Insert data at position start in the file overwriting replace bytes of the original content.This method is slow since it requires rewriting all of the file after the insertion point.
393 394 |
# File 'lib/TagLib_doc.rb', line 393 def insert(data,start = 0,replace = 0) end |
#isOpen ⇒ Object
Since the file can currently only be opened as an argument to the constructor (sort-of by design), this returns if that open succeeded.
343 344 |
# File 'lib/TagLib_doc.rb', line 343 def isOpen() end |
#isValid ⇒ Object
Returns true if the file is open and readble and valid information for the Tag and / or AudioProperties was found.
385 386 |
# File 'lib/TagLib_doc.rb', line 385 def isValid() end |
#isWritable ⇒ Object
323 324 |
# File 'lib/TagLib_doc.rb', line 323 def isWritable() end |
#length ⇒ Object
Returns the length of the file.
415 416 |
# File 'lib/TagLib_doc.rb', line 415 def length() end |
#name ⇒ Object
Returns the file name in the local file system encoding.
328 329 |
# File 'lib/TagLib_doc.rb', line 328 def name() end |
#open? ⇒ Boolean
380 381 |
# File 'lib/TagLib_doc.rb', line 380 def open?() end |
#read_only? ⇒ Boolean
338 339 |
# File 'lib/TagLib_doc.rb', line 338 def read_only?() end |
#readBlock(length) ⇒ Object
Reads a block of size length at the current get pointer.
348 349 |
# File 'lib/TagLib_doc.rb', line 348 def readBlock(length) end |
#readOnly ⇒ Object
Returns true if the file is read only (or if the file can not be opened).
398 399 |
# File 'lib/TagLib_doc.rb', line 398 def readOnly() end |
#removeBlock(start = 0, length = 0) ⇒ Object
Removes a block of the file starting a start and continuing for length bytes.This method is slow since it involves rewriting all of the file after the removed portion.
376 377 |
# File 'lib/TagLib_doc.rb', line 376 def removeBlock(start = 0,length = 0) end |
#rfind(pattern, fromOffset = 0, before = ByteVector::null) ⇒ Object
Returns the offset in the file that pattern occurs at or -1 if it can not be found. If before is set, the search will only continue until the pattern before is found. This is useful for tagging purposes to search for a tag before the synch frame.Searching starts at fromOffset and proceeds from the that point to the beginning of the file and defaults to the end of the file.This has the practial limitation that pattern can not be longer than the buffer size used by readBlock(). Currently this is 1024 bytes.
354 355 |
# File 'lib/TagLib_doc.rb', line 354 def rfind(pattern,fromOffset = 0,before = ByteVector::null) end |
#save ⇒ Object
Save the file and its associated tags. This should be reimplemented in the concrete subclasses. Returns true if the save succeeds.On UNIX multiple processes are able to write to the same file at the same time. This can result in serious file corruption. If you are developing a program that makes use of TagLib from multiple processes you must insure that you are only doing writes to a particular file from one of them.
423 424 |
# File 'lib/TagLib_doc.rb', line 423 def save() end |
#seek(offset, p = Beginning) ⇒ Object
Move the I/O pointer to offset in the file from position p. This defaults to seeking from the beginning of the file.Position
334 335 |
# File 'lib/TagLib_doc.rb', line 334 def seek(offset,p = Beginning) end |
#tag ⇒ Object
Returns a pointer to this file's tag. This should be reimplemented in the concrete subclasses.
364 365 |
# File 'lib/TagLib_doc.rb', line 364 def tag() end |
#tell ⇒ Object
Returns the current offset withing the file.
408 409 |
# File 'lib/TagLib_doc.rb', line 408 def tell() end |
#valid? ⇒ Boolean
417 418 |
# File 'lib/TagLib_doc.rb', line 417 def valid?() end |
#writable? ⇒ Boolean
378 379 |
# File 'lib/TagLib_doc.rb', line 378 def writable?() end |
#writeBlock(data) ⇒ Object
Attempts to write the block data at the current get pointer. If the file is currently only opened read only – i.e. readOnly() returns true – this attempts to reopen the file in read/write mode.This should be used instead of using the streaming output operator for a ByteVector. And even this function is significantly slower than doing output with a char[].
370 371 |
# File 'lib/TagLib_doc.rb', line 370 def writeBlock(data) end |