Miam-Player  0.8.0
A nice music player
TagLib::IOStream Class Referenceabstract

An abstract class that provides operations on a sequence of bytes. More...

#include <tiostream.h>

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

Public Types

enum  Position { Beginning, Current, End }
 Position in the file used for seeking. More...
 

Public Member Functions

 IOStream ()
 
virtual ~IOStream ()
 Destroys this IOStream instance. More...
 
virtual FileName name () const =0
 Returns the stream name in the local file system encoding. More...
 
virtual ByteVector readBlock (unsigned long length)=0
 Reads a block of size length at the current get pointer. More...
 
virtual void writeBlock (const ByteVector &data)=0
 Attempts to write the block data at the current get pointer. More...
 
virtual void insert (const ByteVector &data, unsigned long start=0, unsigned long replace=0)=0
 Insert data at position start in the file overwriting replace bytes of the original content. More...
 
virtual void removeBlock (unsigned long start=0, unsigned long length=0)=0
 Removes a block of the file starting a start and continuing for length bytes. More...
 
virtual bool readOnly () const =0
 Returns true if the file is read only (or if the file can not be opened). More...
 
virtual bool isOpen () const =0
 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...
 
virtual void seek (long offset, Position p=Beginning)=0
 Move the I/O pointer to offset in the stream from position p. More...
 
virtual void clear ()
 Reset the end-of-stream and error flags on the stream. More...
 
virtual long tell () const =0
 Returns the current offset within the stream. More...
 
virtual long length ()=0
 Returns the length of the stream. More...
 
virtual void truncate (long length)=0
 Truncates the stream to a length. More...
 

Detailed Description

An abstract class that provides operations on a sequence of bytes.

Member Enumeration Documentation

◆ Position

Position in the file used for seeking.

Enumerator
Beginning 

Seek from the beginning of the file.

Current 

Seek from the current position in the file.

End 

Seek from the end of the file.

Constructor & Destructor Documentation

◆ IOStream()

TagLib::IOStream::IOStream ( )

◆ ~IOStream()

virtual TagLib::IOStream::~IOStream ( )
virtual

Destroys this IOStream instance.

Member Function Documentation

◆ clear()

virtual void TagLib::IOStream::clear ( )
virtual

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

Reimplemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ insert()

virtual void TagLib::IOStream::insert ( const ByteVector data,
unsigned long  start = 0,
unsigned long  replace = 0 
)
pure 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.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ isOpen()

virtual bool TagLib::IOStream::isOpen ( ) const
pure 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.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ length()

virtual long TagLib::IOStream::length ( )
pure virtual

Returns the length of the stream.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ name()

virtual FileName TagLib::IOStream::name ( ) const
pure virtual

Returns the stream name in the local file system encoding.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ readBlock()

virtual ByteVector TagLib::IOStream::readBlock ( unsigned long  length)
pure virtual

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

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ readOnly()

virtual bool TagLib::IOStream::readOnly ( ) const
pure virtual

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

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ removeBlock()

virtual void TagLib::IOStream::removeBlock ( unsigned long  start = 0,
unsigned long  length = 0 
)
pure 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.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ seek()

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

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

This defaults to seeking from the beginning of the stream.

See also
Position

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ tell()

virtual long TagLib::IOStream::tell ( ) const
pure virtual

Returns the current offset within the stream.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ truncate()

virtual void TagLib::IOStream::truncate ( long  length)
pure virtual

Truncates the stream to a length.

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.

◆ writeBlock()

virtual void TagLib::IOStream::writeBlock ( const ByteVector data)
pure 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[].

Implemented in TagLib::FileStream, and TagLib::ByteVectorStream.


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