1
0
mirror of https://github.com/danog/file.git synced 2024-12-02 09:17:57 +01:00
file/lib/Descriptor.php

48 lines
964 B
PHP
Raw Normal View History

2015-07-11 03:59:39 +02:00
<?php
namespace Amp\Fs;
interface Descriptor {
/**
* Read $len bytes from the open file handle starting at $offset
*
* @param int $offset
* @param int $len
* @return \Amp\Promise
*/
2015-07-17 16:27:38 +02:00
public function read($offset, $len);
2015-07-11 03:59:39 +02:00
/**
* Write $data to the open file handle starting at $offset
*
* @param int $offset
* @param string $data
* @return \Amp\Promise
*/
2015-07-17 16:27:38 +02:00
public function write($offset, $data);
2015-07-11 03:59:39 +02:00
/**
* Truncate the file to the specified $length
*
* Note: The descriptor must be opened for writing
*
* @param int $length
* @return \Amp\Promise
*/
2015-07-17 16:27:38 +02:00
public function truncate($length = 0);
2015-07-11 03:59:39 +02:00
/**
* Retrieve the filesystem stat array for the current descriptor
*
* @return \Amp\Promise
*/
2015-07-17 16:27:38 +02:00
public function stat();
2015-07-11 03:59:39 +02:00
/**
* Close the file handle
*
* @return \Amp\Promise
*/
2015-07-17 16:27:38 +02:00
public function close();
2015-07-11 03:59:39 +02:00
}