mirror of
https://github.com/ariya/phantomjs.git
synced 2024-09-17 15:47:09 +03:00
Add seek
method to File
class
This method is necessary for random-access streams. It will also be helpful in the future when implementing the [IO/A spec][1]. [1]: http://wiki.commonjs.org/wiki/IO/A#Instance_Methods http://code.google.com/p/phantomjs/issues/detail?id=937
This commit is contained in:
parent
f6c87221a7
commit
6bc3a93118
@ -110,6 +110,15 @@ bool File::write(const QString &data)
|
||||
}
|
||||
}
|
||||
|
||||
bool File::seek(const qint64 pos)
|
||||
{
|
||||
if (m_fileStream) {
|
||||
return m_fileStream->seek(pos);
|
||||
} else {
|
||||
return m_file->seek(pos);
|
||||
}
|
||||
}
|
||||
|
||||
QString File::readLine()
|
||||
{
|
||||
if ( !m_file->isReadable() ) {
|
||||
|
@ -52,6 +52,8 @@ public slots:
|
||||
QString read();
|
||||
bool write(const QString &data);
|
||||
|
||||
bool seek(const qint64 pos);
|
||||
|
||||
QString readLine();
|
||||
bool writeLine(const QString &data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user