1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-27 04:14:49 +01:00
byte-stream/lib/Stream.php
Aaron Piotrowski b1950f87f5 Initial commit
2016-08-10 16:52:25 -05:00

47 lines
930 B
PHP

<?php
namespace Amp\Stream;
interface Stream {
/**
* Determines if the stream is readable.
*
* @return bool
*/
public function isReadable();
/**
* Determines if the stream is writable.
*
* @return bool
*/
public function isWritable();
/**
* @param int|null $bytes
* @param string|null $delimiter
*
* @return \Interop\Async\Awaitable<string> Resolves with bytes read from the stream.
*/
public function read($bytes = null, $delimiter = null);
/**
* @param string $data
*
* @return \Interop\Async\Awaitable<int>
*/
public function write($data);
/**
* @param string $data
*
* @return \Interop\Async\Awaitable<int>
*/
public function end($data = '');
/**
* Closes the stream and fails any pending reads or writes.
*/
public function close();
}