Contentserv PHP API

CSFileStreamInterface
in

Defines the interface for a file stream API object to read meta-data information and read & write content as a stream.

Tags
since

PIM24.0.0

Table of Contents

STREAM_MODE_READ  = 'r'
Available stream mode types.
STREAM_MODE_READ_AND_WRITE  = 'r+'
STREAM_MODE_WRITE  = 'w'
STREAM_MODE_WRITE_AND_READ  = 'w+'
STREAM_TYPE_DOWNLOAD  = 4
STREAM_TYPE_DOWNLOAD_AS_ZIP  = 5
STREAM_TYPE_PATH  = 0
Available stream types.
STREAM_TYPE_PATH_AS_ZIP  = 1
STREAM_TYPE_PRINT  = 2
STREAM_TYPE_PRINT_AND_DIE  = 3
STREAM_TYPE_RUN_IN_BACKGROUND  = 6
closeStream()  : bool
Closes the file stream API object.
delete()  : bool
Deletes the file stream API object.
exists()  : bool
Checks whether the file stream API object exists.
getBaseName()  : string
Returns the base name of the file stream API object.
getContent()  : mixed
Returns the content of the file stream API object.
getCreationTimestamp()  : int
Returns the creation timestamp of the file stream API object.
getLocalPath()  : string
Returns the local file path of the file stream API object.
getModificationTimestamp()  : int
Returns the modification timestamp of the file stream API object.
getName()  : string
Returns the name of the file stream API object.
getSize()  : int
Returns the file size of the file stream API object.
getType()  : string
Returns the file type of the file stream API object.
isEndOfStream()  : bool
Checks whether it is the end of the stream.
isFolder()  : bool
Checks if the file stream API object is a folder.
isLocal()  : bool
Checks if the file stream API object is a local file.
isReadableStream()  : bool
Checks if the stream is readable.
isSeekableStream()  : bool
Checks if the stream is seekable.
isWritableStream()  : bool
Checks if the stream is writable.
openStream()  : void
Opens the stream file.
readStream()  : string
Reads the content of the stream with the given length.
rewindStream()  : void
Rewinds the stream file API object.
seekStream()  : void
Seeks the stream file API objects.
streamContent()  : void
Streams the content for the given stream type.
writeStream()  : int|false
Writes the given content to the file stream API object.

Constants

Methods

closeStream()

Closes the file stream API object.

public closeStream() : bool
Tags
Return values
bool

delete()

Deletes the file stream API object.

public delete() : bool
Tags
Return values
bool

exists()

Checks whether the file stream API object exists.

public exists() : bool
Tags
Return values
bool

getBaseName()

Returns the base name of the file stream API object.

public getBaseName() : string
Tags
Return values
string

getContent()

Returns the content of the file stream API object.

public getContent() : mixed
Tags
Return values
mixed

getCreationTimestamp()

Returns the creation timestamp of the file stream API object.

public getCreationTimestamp() : int
Tags
Return values
int

getLocalPath()

Returns the local file path of the file stream API object.

public getLocalPath([bool $bDownloadRemoteFileIfNotExisting = false ]) : string

If the file stream API object is located on a remote storage, it can be downloaded with the parameter.

Parameters
$bDownloadRemoteFileIfNotExisting : bool = false

Whether the file should be downloaded if it is located on a remote storage.

Tags
Return values
string

getModificationTimestamp()

Returns the modification timestamp of the file stream API object.

public getModificationTimestamp() : int
Tags
Return values
int

getName()

Returns the name of the file stream API object.

public getName() : string
Tags
Return values
string

getSize()

Returns the file size of the file stream API object.

public getSize() : int
Tags
Return values
int

getType()

Returns the file type of the file stream API object.

public getType() : string
Tags
Return values
string

isEndOfStream()

Checks whether it is the end of the stream.

public isEndOfStream() : bool
Tags
Return values
bool

isFolder()

Checks if the file stream API object is a folder.

public isFolder() : bool
Tags
Return values
bool

isLocal()

Checks if the file stream API object is a local file.

public isLocal() : bool
Tags
Return values
bool

isReadableStream()

Checks if the stream is readable.

public isReadableStream() : bool
Tags
Return values
bool

isSeekableStream()

Checks if the stream is seekable.

public isSeekableStream() : bool
Tags
Return values
bool

isWritableStream()

Checks if the stream is writable.

public isWritableStream() : bool
Tags
Return values
bool

openStream()

Opens the stream file.

public openStream(string $sMode) : void
Parameters
$sMode : string

The target stream mode

Tags
Return values
void

readStream()

Reads the content of the stream with the given length.

public readStream([int|null $iLength = null ]) : string
Parameters
$iLength : int|null = null
Tags
Return values
string

rewindStream()

Rewinds the stream file API object.

public rewindStream() : void
Tags
Return values
void

seekStream()

Seeks the stream file API objects.

public seekStream(int $iOffset[, int $iWhence = SEEK_SET ]) : void
Parameters
$iOffset : int

To move to a position before the end-of-file, you need to pass a negative value in offset and set whence to SEEK_END.

$iWhence : int = SEEK_SET

Whence values are: SEEK_SET - Set position equal to offset bytes. SEEK_CUR - Set position to current location plus offset. SEEK_END - Set position to end-of-file plus offset. If whence is not specified, it is assumed to be SEEK_SET.

Tags
Return values
void

streamContent()

Streams the content for the given stream type.

public streamContent([int $iStreamType = self::STREAM_TYPE_PRINT_AND_DIE ][, string $sTargetFileName = '' ]) : void
Parameters
$iStreamType : int = self::STREAM_TYPE_PRINT_AND_DIE

The target stream type to stream the content.

$sTargetFileName : string = ''

The target file name of the stream file.

Tags
Return values
void

writeStream()

Writes the given content to the file stream API object.

public writeStream(string $sContent[, int|null $iLength = null ]) : int|false
Parameters
$sContent : string

The content, which should be written to the file.

$iLength : int|null = null

If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first.

Tags
Return values
int|false

        

Search results