PHP 5 has reached end of support and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy PHP 5
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing PHP
5 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of PHP.
\google\appengine\ext\cloud_storage_streams\CloudStorageStreamWrapper
Stay organized with collections
Save and categorize content based on your preferences.
FINAL
A user space stream wrapper for reading and writing to Google Cloud Storage.
See: http://www.php.net/manual/en/class.streamwrapper.php
Allowed stream_context options.
"anonymous": Boolean, if set then OAuth tokens will not be generated.
"acl": The ACL to apply when creating an object.
"Content-Type": The content type of the object being written.
Constants
STREAM_OPEN_FOR_INCLUDE
Properties
$context
$context :
Type
Methods
__construct
__construct()
Constructs a new stream wrapper.
__destruct
__destruct()
Destructs an existing stream wrapper.
dir_closedir
dir_closedir()
Close an open directory handle.
dir_opendir
dir_opendir( $path, $options)
Open a directory handle.
Parameters
Name |
Description |
$path
|
|
$options
|
|
dir_readdir
dir_readdir() : string
Read entry from the directory handle.
Returns
string
representing the next filename, of false if there is no
next file.
dir_rewinddir
dir_rewinddir() : boolean
Reset the output returned from dir_readdir.
Returns
boolean
true if the stream can be rewound, false otherwise.
mkdir
mkdir( $path, $mode, $options)
Parameters
Name |
Description |
$path
|
|
$mode
|
|
$options
|
|
rmdir
rmdir( $path, $options)
Parameters
Name |
Description |
$path
|
|
$options
|
|
rename
rename( $from, $to) : TRUE
Rename a cloud storage object.
Parameters
Name |
Description |
$from
|
|
$to
|
|
Returns
TRUE
if the object was renamed, FALSE otherwise
stream_cast
stream_cast()
Retrieve the underlaying resource of the stream, called in response to
stream_select().
As GS streams have no underlying resource, we can only return false
stream_close
stream_close()
All resources that were locked, or allocated, by the wrapper should be
released.
No value is returned.
stream_eof
stream_eof() : TRUE
Tests for end-of-file on a file pointer.
Returns
TRUE
if the read/write position is at the end of the stream and if
no more data is available to be read, or FALSE otherwise
stream_flush
stream_flush() : TRUE
Flushes the output.
Returns
TRUE
if the cached data was successfully stored (or if there was
no data to store), or FALSE if the data could not be stored.
stream_metadata( $path, $option, $value)
Parameters
Name |
Description |
$path
|
|
$option
|
|
$value
|
|
stream_lock
stream_lock( $operation)
Parameters
Name |
Description |
$operation
|
|
stream_open
stream_open( $path, $mode, $options, $opened_path)
Parameters
Name |
Description |
$path
|
|
$mode
|
|
$options
|
|
$opened_path
|
|
stream_read
stream_read( $count)
Read from a stream, return string of bytes.
Parameters
stream_seek
stream_seek( $offset, $whence)
Parameters
Name |
Description |
$offset
|
|
$whence
|
|
stream_set_option
stream_set_option( $option, $arg1, $arg2)
Parameters
Name |
Description |
$option
|
|
$arg1
|
|
$arg2
|
|
stream_stat
stream_stat()
stream_tell
stream_tell()
stream_write
stream_write( $data)
Return the number of bytes written.
Parameters
unlink
unlink( $path)
Deletes a file. Called in response to unlink($filename).
Parameters
url_stat
url_stat( $path, $flags)
Parameters
Name |
Description |
$path
|
|
$flags
|
|
getMetaData()
getContentType
getContentType()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThis is a user space stream wrapper designed for reading from and writing to Google Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eThe wrapper supports several stream context options, including setting "anonymous" mode, defining an "acl", and specifying "Content-Type".\u003c/p\u003e\n"],["\u003cp\u003eIt implements various stream-related methods like \u003ccode\u003edir_closedir\u003c/code\u003e, \u003ccode\u003edir_opendir\u003c/code\u003e, \u003ccode\u003estream_read\u003c/code\u003e, \u003ccode\u003estream_write\u003c/code\u003e, and \u003ccode\u003estream_close\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eMethods are also provided for file management operations such as renaming (\u003ccode\u003erename\u003c/code\u003e), creating directories (\u003ccode\u003emkdir\u003c/code\u003e), deleting files (\u003ccode\u003eunlink\u003c/code\u003e), and removing directories (\u003ccode\u003ermdir\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eCertain methods, such as \u003ccode\u003estream_cast\u003c/code\u003e, return false, indicating that Google Cloud Storage streams do not have a direct underlying resource.\u003c/p\u003e\n"]]],[],null,["# \\google\\appengine\\ext\\cloud_storage_streams\\CloudStorageStreamWrapper\n\nFINAL\n\nA user space stream wrapper for reading and writing to Google Cloud Storage.\n\nSee: \u003chttp://www.php.net/manual/en/class.streamwrapper.php\u003e\n\nAllowed stream_context options.\n\"anonymous\": Boolean, if set then OAuth tokens will not be generated.\n\"acl\": The ACL to apply when creating an object.\n\"Content-Type\": The content type of the object being written.\n\nConstants\n---------\n\n### STREAM_OPEN_FOR_INCLUDE\n\nProperties\n----------\n\n### $context\n\n`$context : `\n\n#### Type\n\nMethods\n-------\n\n### __construct\n\n`__construct() `\n\nConstructs a new stream wrapper.\n\n### __destruct\n\n`__destruct() `\n\nDestructs an existing stream wrapper.\n\n### dir_closedir\n\n`dir_closedir() `\n\nClose an open directory handle.\n\n### dir_opendir\n\n`dir_opendir( `$path`, `$options`) `\n\nOpen a directory handle.\n\n#### Parameters\n\n### dir_readdir\n\n`dir_readdir() : string`\n\nRead entry from the directory handle.\n\n#### Returns\n\n`string`\n\nrepresenting the next filename, of false if there is no\nnext file.\n\n### dir_rewinddir\n\n`dir_rewinddir() : boolean`\n\nReset the output returned from dir_readdir.\n\n#### Returns\n\n`boolean`\n\ntrue if the stream can be rewound, false otherwise.\n\n### mkdir\n\n`mkdir( `$path`, `$mode`, `$options`) `\n\n\n#### Parameters\n\n### rmdir\n\n`rmdir( `$path`, `$options`) `\n\n\n#### Parameters\n\n### rename\n\n`rename( `$from`, `$to`) : TRUE`\n\nRename a cloud storage object.\n\n#### Parameters\n\n#### Returns\n\n`TRUE`\n\nif the object was renamed, FALSE otherwise\n\n### stream_cast\n\n`stream_cast() `\n\nRetrieve the underlaying resource of the stream, called in response to\nstream_select().\n\nAs GS streams have no underlying resource, we can only return false\n\n### stream_close\n\n`stream_close() `\n\nAll resources that were locked, or allocated, by the wrapper should be\nreleased.\n\nNo value is returned.\n\n### stream_eof\n\n`stream_eof() : TRUE`\n\nTests for end-of-file on a file pointer.\n\n#### Returns\n\n`TRUE`\n\nif the read/write position is at the end of the stream and if\nno more data is available to be read, or FALSE otherwise\n\n### stream_flush\n\n`stream_flush() : TRUE`\n\nFlushes the output.\n\n#### Returns\n\n`TRUE`\n\nif the cached data was successfully stored (or if there was\nno data to store), or FALSE if the data could not be stored.\n\n### stream_metadata\n\n`stream_metadata( `$path`, `$option`, `$value`) `\n\n\n#### Parameters\n\n### stream_lock\n\n`stream_lock( `$operation`) `\n\n\n#### Parameters\n\n### stream_open\n\n`stream_open( `$path`, `$mode`, `$options`, `$opened_path`) `\n\n\n#### Parameters\n\n### stream_read\n\n`stream_read( `$count`) `\n\nRead from a stream, return string of bytes.\n\n#### Parameters\n\n### stream_seek\n\n`stream_seek( `$offset`, `$whence`) `\n\n\n#### Parameters\n\n### stream_set_option\n\n`stream_set_option( `$option`, `$arg1`, `$arg2`) `\n\n\n#### Parameters\n\n### stream_stat\n\n`stream_stat() `\n\n\n### stream_tell\n\n`stream_tell() `\n\n\n### stream_write\n\n`stream_write( `$data`) `\n\nReturn the number of bytes written.\n\n#### Parameters\n\n### unlink\n\n`unlink( `$path`) `\n\nDeletes a file. Called in response to unlink($filename).\n\n#### Parameters\n\n### url_stat\n\n`url_stat( `$path`, `$flags`) `\n\n\n#### Parameters\n\n### getMetaData\n\n`getMetaData() `\n\n\n### getContentType\n\n`getContentType() `"]]