15#include "kanoopcommon.h"
43 static bool readAllBytes(
const QString& filename, QByteArray& data);
52 static bool readAllLines(
const QString& filename, QStringList& data, QStringConverter::Encoding encoding = QStringConverter::Utf8);
60 static bool writeAllBytes(
const QString& filename,
const QByteArray& data);
69 static bool writeAllBytes(
const QString& filename,
const QByteArray& data, QStringConverter::Encoding encoding);
77 static bool writeAllLines(
const QString& filename,
const QStringList& lines);
99 static bool exists(
const QString& filename);
106 static bool remove(
const QString& filename);
113 static bool touch(
const QString& filename);
121 static bool move(
const QString& source,
const QString& destination);
129 static bool moveToDirectory(
const QString& sourceFilename,
const QString& destinationDirectory);
static bool exists(const QString &filename)
Test whether a file exists.
static bool remove(const QString &filename)
Remove (delete) a file.
static QString getTempFilename()
Generate a unique temporary file path.
static QByteArray getMD5Bytes(const QString &filename)
Compute the MD5 hash of a file as raw bytes.
static bool appendAllBytes(const QString &filename, const QByteArray &data)
Append a byte array to an existing file (or create if absent).
static bool touch(const QString &filename)
Create an empty file or update its modification time if it exists.
static bool writeAllLines(const QString &filename, const QStringList &lines)
Write a list of strings to a file, one per line.
static bool writeAllBytes(const QString &filename, const QByteArray &data, QStringConverter::Encoding encoding)
Write a byte array to a file using a specific text encoding.
static bool writeAllBytes(const QString &filename, const QByteArray &data)
Write a byte array to a file, overwriting any existing content.
static QString getMD5String(const QString &filename)
Compute the MD5 hash of a file as a hex string.
static int lineCount(const QString &filename)
Count the number of lines in a text file.
static bool moveToDirectory(const QString &sourceFilename, const QString &destinationDirectory)
Move a file into a destination directory, preserving its basename.
static bool setModifyTime(const QString &filename, const QDateTime &value)
Set the modification timestamp of a file.
static bool readAllLines(const QString &filename, QStringList &data, QStringConverter::Encoding encoding=QStringConverter::Utf8)
Read all lines of a text file into a string list.
static bool readAllBytes(const QString &filename, QByteArray &data)
Read the entire contents of a file into a byte array.
static bool move(const QString &source, const QString &destination)
Move (rename) a file from one path to another.