FileFd Class Reference
Collaboration diagram for FileFd:
[legend]

## Public Types

enum

OpenMode {
ReadOnly = (1 << 0) , WriteOnly = (1 << 1) , ReadWrite = ReadOnly | WriteOnly , Create = (1 << 2) ,
Exclusive = (1 << 3) , Atomic = Exclusive | (1 << 4) , Empty = (1 << 5) , BufferedWrite = (1 << 6) ,
WriteEmpty = ReadWrite | Create | Empty , WriteExists = ReadWrite , WriteAny = ReadWrite | Create , WriteTemp = ReadWrite | Create | Exclusive ,
ReadOnlyGzip , WriteAtomic = ReadWrite | Create | Atomic
}

enum | CompressMode { Auto = 'A' , None = 'N' , Extension = 'E' , Gzip = 'G' , Bzip2 = 'B' , Lzma = 'L' , Xz = 'X' , Lz4 = '4' , Zstd = 'Z' }

## Public Member Functions

bool | Read (void *To, unsigned long long Size, bool AllowEof)
bool | Read (void *To, unsigned long long Size, unsigned long long *Actual=0)
char * | ReadLine (char *To, unsigned long long const Size)
bool | ReadLine (std::string &To)
bool | Flush ()
bool | Write (const void *From, unsigned long long Size)
bool | Seek (unsigned long long To)
bool | Skip (unsigned long long To)
bool | Truncate (unsigned long long To)
unsigned long long | Tell ()
unsigned long long | Size ()
unsigned long long | FileSize ()
time_t | ModificationTime ()
bool | Open (std::string FileName, unsigned int const Mode, CompressMode Compress, unsigned long const AccessMode=0666)
bool | Open (std::string FileName, unsigned int const Mode, APT::Configuration::Compressor const &compressor, unsigned long const AccessMode=0666)
bool | Open (std::string FileName, unsigned int const Mode, unsigned long const AccessMode=0666)
bool | OpenDescriptor (int Fd, unsigned int const Mode, CompressMode Compress, bool AutoClose=false)
bool | OpenDescriptor (int Fd, unsigned int const Mode, APT::Configuration::Compressor const &compressor, bool AutoClose=false)
bool | OpenDescriptor (int Fd, unsigned int const Mode, bool AutoClose=false)
bool | Close ()
bool | Sync ()
int | Fd ()
void | Fd (int fd)
bool | IsOpen ()
bool | Failed ()
void | EraseOnFailure ()
void | OpFail ()
bool | Eof ()
bool | IsCompressed ()
std::string & | Name ()
void | SetFileName (std::string const &name)
| FileFd (std::string FileName, unsigned int const Mode, unsigned long AccessMode=0666)
| FileFd (std::string FileName, unsigned int const Mode, CompressMode Compress, unsigned long AccessMode=0666)
| FileFd (int const Fd, unsigned int const Mode=ReadWrite, CompressMode Compress=None)
| FileFd (int const Fd, bool const AutoClose)

## Static Public Member Functions

static bool | Read (int const Fd, void *To, unsigned long long Size, unsigned long long *const Actual=0)
static bool | Write (int Fd, const void *From, unsigned long long Size)

## Protected Types

enum | LocalFlags { AutoClose = (1<<0) , Fail = (1<<1) , DelOnFail = (1<<2) , HitEof = (1<<3) , Replace = (1<<4) , Compressed = (1<<5) }

## Protected Attributes

int | iFd
unsigned long | Flags
std::string | FileName
std::string | TemporaryFileName

## Friends

class | FileFdPrivate
class | GzipFileFdPrivate
class | Bz2FileFdPrivate
class | LzmaFileFdPrivate
class | Lz4FileFdPrivate
class | ZstdFileFdPrivate
class | DirectFileFdPrivate
class | PipedFileFdPrivate

## Member Function Documentation

## ReadLine() [1/2]

char * ReadLine | ( | char * | To,
|  | unsigned long long const | Size )

read a complete line or until buffer is full

The buffer will always be \0 terminated, so at most Size-1 characters are read. If the buffer holds a complete line the last character (before \0) will be the newline character \n otherwise the line was longer than the buffer.

Parameters

  To | buffer which will hold the line
  Size | of the buffer to fill

b nullptr is returned in error cases, otherwise the parameter To now filled with the line.

Referenced by pkgAcqChangelog::URI().

## ReadLine() [2/2]

bool ReadLine | ( | std::string & | To | ) |

read a complete line from the file

Similar to std::getline() the string does not include the newline, but just the content of the line as the newline is not needed to distinguish cases as for the other ReadLine method.

Parameters

  To | string which will hold the line

Returns
  true if successful, otherwise false

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

- apt-pkg/contrib/fileutl.h
- apt-pkg/contrib/fileutl.cc