Miam-Player  0.8.0
A nice music player
TagLib::FileStream Class Reference

A file class with some useful methods for tag manipulation. More...

#include <tfilestream.h>

Inheritance diagram for TagLib::FileStream:
TagLib::IOStream

Public Member Functions

 FileStream (FileName file, bool openReadOnly=false)
 Construct a File object and opens the file. More...
 
virtual ~FileStream ()
 Destroys this FileStream instance. More...
 
FileName name () const
 Returns the file name in the local file system encoding. More...
 
ByteVector readBlock (unsigned long length)
 Reads a block of size length at the current get pointer. More...
 
void writeBlock (const ByteVector &data)
 Attempts to write the block data at the current get pointer. More...
 
void insert (const ByteVector &data, unsigned long start=0, unsigned long replace=0)
 Insert data at position start in the file overwriting replace bytes of the original content. More...
 
void removeBlock (unsigned long start=0, unsigned long length=0)
 Removes a block of the file starting a start and continuing for length bytes. More...
 
bool readOnly () const
 Returns true if the file is read only (or if the file can not be opened). More...
 
bool isOpen () const
 Since the file can currently only be opened as an argument to the constructor (sort-of by design), this returns if that open succeeded. More...
 
void seek (long offset, Position p=Beginning)
 Move the I/O pointer to offset in the file from position p. More...
 
void clear ()
 Reset the end-of-file and error flags on the file. More...
 
long tell () const
 Returns the current offset within the file. More...
 
long length ()
 Returns the length of the file. More...
 
void truncate (long length)
 Truncates the file to a length. More...
 
- Public Member Functions inherited from TagLib::IOStream
 IOStream ()
 
virtual ~IOStream ()
 Destroys this IOStream instance. More...
 

Static Protected Member Functions

static unsigned int bufferSize ()
 Returns the buffer size that is used for internal buffering. More...
 

Additional Inherited Members

- Public Types inherited from TagLib::IOStream
enum  Position { Beginning, Current, End }
 Position in the file used for seeking. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

TagLib::FileStream::FileStream ( FileName  file,
bool  openReadOnly = false 
)

Construct a File object and opens the file.

file should be a be a C-string in the local file system encoding.

virtual TagLib::FileStream::~FileStream ( )
virtual

Destroys this FileStream instance.

Member Function Documentation

static unsigned int TagLib::FileStream::bufferSize ( )
staticprotected

Returns the buffer size that is used for internal buffering.

void TagLib::FileStream::clear ( )
virtual

Reset the end-of-file and error flags on the file.

Reimplemented from TagLib::IOStream.

void TagLib::FileStream::insert ( const ByteVector data,
unsigned long  start = 0,
unsigned long  replace = 0 
)
virtual

Insert data at position start in the file overwriting replace bytes of the original content.

Note
This method is slow since it requires rewriting all of the file after the insertion point.

Implements TagLib::IOStream.

bool TagLib::FileStream::isOpen ( ) const
virtual

Since the file can currently only be opened as an argument to the constructor (sort-of by design), this returns if that open succeeded.

Implements TagLib::IOStream.

long TagLib::FileStream::length ( )
virtual

Returns the length of the file.

Implements TagLib::IOStream.

FileName TagLib::FileStream::name ( ) const
virtual

Returns the file name in the local file system encoding.

Implements TagLib::IOStream.

ByteVector TagLib::FileStream::readBlock ( unsigned long  length)
virtual

Reads a block of size length at the current get pointer.

Implements TagLib::IOStream.

bool TagLib::FileStream::readOnly ( ) const
virtual

Returns true if the file is read only (or if the file can not be opened).

Implements TagLib::IOStream.

void TagLib::FileStream::removeBlock ( unsigned long  start = 0,
unsigned long  length = 0 
)
virtual

Removes a block of the file starting a start and continuing for length bytes.

Note
This method is slow since it involves rewriting all of the file after the removed portion.

Implements TagLib::IOStream.

void TagLib::FileStream::seek ( long  offset,
Position  p = Beginning 
)
virtual

Move the I/O pointer to offset in the file from position p.

This defaults to seeking from the beginning of the file.

See also
Position

Implements TagLib::IOStream.

long TagLib::FileStream::tell ( ) const
virtual

Returns the current offset within the file.

Implements TagLib::IOStream.

void TagLib::FileStream::truncate ( long  length)
virtual

Truncates the file to a length.

Implements TagLib::IOStream.

void TagLib::FileStream::writeBlock ( const ByteVector data)
virtual

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.

Note
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[].

Implements TagLib::IOStream.


The documentation for this class was generated from the following file: