TagLib API Documentation
Public Member Functions | List of all members
TagLib::ByteVectorStream Class Reference

In-memory Stream class using ByteVector for its storage. More...

#include <tbytevectorstream.h>

Inheritance diagram for TagLib::ByteVectorStream:
Collaboration diagram for TagLib::ByteVectorStream:

Public Member Functions

 ByteVectorStream (const ByteVector &data)
virtual ~ByteVectorStream ()
FileName name () const
ByteVector readBlock (unsigned long length)
void writeBlock (const ByteVector &data)
void insert (const ByteVector &data, unsigned long start=0, unsigned long replace=0)
void removeBlock (unsigned long start=0, unsigned long length=0)
bool readOnly () const
bool isOpen () const
void seek (long offset, Position p=Beginning)
void clear ()
long tell () const
long length ()
void truncate (long length)
ByteVectordata ()
- Public Member Functions inherited from TagLib::IOStream
 IOStream ()
virtual ~IOStream ()

Additional Inherited Members

- Public Types inherited from TagLib::IOStream
enum  Position { Beginning , Current , End }

Detailed Description

In-memory Stream class using ByteVector for its storage.

Constructor & Destructor Documentation

◆ ByteVectorStream()

TagLib::ByteVectorStream::ByteVectorStream ( const ByteVector data)

Construct a File object and opens the file. file should be a be a C-string in the local file system encoding.

◆ ~ByteVectorStream()

virtual TagLib::ByteVectorStream::~ByteVectorStream ( )

Destroys this ByteVectorStream instance.

Member Function Documentation

◆ clear()

void TagLib::ByteVectorStream::clear ( )

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

Reimplemented from TagLib::IOStream.

◆ data()

ByteVector* TagLib::ByteVectorStream::data ( )

◆ insert()

void TagLib::ByteVectorStream::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.

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

Implements TagLib::IOStream.

◆ isOpen()

bool TagLib::ByteVectorStream::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.

Implements TagLib::IOStream.

◆ length()

long TagLib::ByteVectorStream::length ( )

Returns the length of the file.

Implements TagLib::IOStream.

◆ name()

FileName TagLib::ByteVectorStream::name ( ) const

Returns the file name in the local file system encoding.

Implements TagLib::IOStream.

◆ readBlock()

ByteVector TagLib::ByteVectorStream::readBlock ( unsigned long  length)

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

Implements TagLib::IOStream.

◆ readOnly()

bool TagLib::ByteVectorStream::readOnly ( ) const

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

Implements TagLib::IOStream.

◆ removeBlock()

void TagLib::ByteVectorStream::removeBlock ( unsigned long  start = 0,
unsigned long  length = 0 

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.

Implements TagLib::IOStream.

◆ seek()

void TagLib::ByteVectorStream::seek ( long  offset,
Position  p = Beginning 

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

Implements TagLib::IOStream.

◆ tell()

long TagLib::ByteVectorStream::tell ( ) const

Returns the current offset within the file.

Implements TagLib::IOStream.

◆ truncate()

void TagLib::ByteVectorStream::truncate ( long  length)

Truncates the file to a length.

Implements TagLib::IOStream.

◆ writeBlock()

void TagLib::ByteVectorStream::writeBlock ( const ByteVector data)

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

Implements TagLib::IOStream.

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