Naify\Psr\Contract\StreamInterface インターフェース
implements
Stringable
ストリームインターフェース — PSR-7 StreamInterface 相当
HTTP メッセージボディの読み書きを抽象化する。
使用例
$body = $response->getBody();
$body->write('hello');
$body->rewind();
echo $body->getContents();
メソッド
| メソッド | 説明 |
|---|---|
public
close(): void
|
ストリームを閉じる |
public
detach():
|
内部リソースを切り離して返す。以降は操作不可 @return resource|null |
public
getSize(): ?int
|
ストリームのバイト数を返す。不明なら null |
public
tell(): int
|
現在のポインタ位置を返す |
public
eof(): bool
|
ポインタが末尾に達しているか |
public
isSeekable(): bool
|
シーク可能か |
public
seek(int $offset, int $whence = 0): void
|
ポインタを移動する |
public
rewind(): void
|
ポインタを先頭に戻す |
public
isWritable(): bool
|
書き込み可能か |
public
write(string $string): int
|
文字列を書き込む |
public
isReadable(): bool
|
読み取り可能か |
public
read(int $length): string
|
指定バイト数だけ読み取る |
public
getContents(): string
|
現在位置から末尾まで読み取る |
public
getMetadata(?string $key): mixed
|
ストリームのメタデータを返す |