Contentserv PHP API

CSLocalFile extends CSFileStream
in package

Tags

Table of Contents

__construct()  : mixed
__toString()  : string
Reads all data from the stream into a string, from the beginning to end.
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.
setContentFromPath()  : bool
Sets the content from a given file path.
setContentFromStream()  : bool
Sets the content from a given stream file API object.
setContentFromString()  : bool
Sets the content from string content.
streamContent()  : void
Streams the content for the given stream type.
writeStream()  : int|false
Writes the given content to the file stream API object.

Methods

__construct()

public __construct(string $sLocalPath) : mixed
Parameters
$sLocalPath : string
Tags
inheritDoc
Return values
mixed

__toString()

Reads all data from the stream into a string, from the beginning to end.

public __toString() : string

This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.

Warning: This could attempt to load a large amount of data into memory.

This method MUST NOT raise an exception in order to conform with PHP's string casting operations.

Tags
see
http://php.net/manual/en/language.oop5.magic.php#object.tostring
Return values
string

closeStream()

Closes the file stream API object.

public closeStream() : bool
Tags
inheritDoc
Return values
bool

delete()

Deletes the file stream API object.

public delete() : bool
Tags
inheritDoc
Return values
bool

exists()

Checks whether the file stream API object exists.

public exists() : bool
Tags
inheritDoc
Return values
bool

getBaseName()

Returns the base name of the file stream API object.

public getBaseName() : string
Tags
inheritDoc
Return values
string

getContent()

Returns the content of the file stream API object.

public getContent() : mixed
Tags
inheritDoc
Return values
mixed

getCreationTimestamp()

Returns the creation timestamp of the file stream API object.

public getCreationTimestamp() : int
Tags
inheritDoc
Return values
int

getLocalPath()

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

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

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

Tags
inheritDoc
Return values
string

getModificationTimestamp()

Returns the modification timestamp of the file stream API object.

public getModificationTimestamp() : int
Tags
inheritDoc
Return values
int

getName()

Returns the name of the file stream API object.

public getName() : string
Tags
inheritDoc
Return values
string

getSize()

Returns the file size of the file stream API object.

public getSize() : int
Tags
inheritDoc
Return values
int

getType()

Returns the file type of the file stream API object.

public getType() : string
Tags
inheritDoc
Return values
string

isEndOfStream()

Checks whether it is the end of the stream.

public isEndOfStream() : bool
Tags
inheritDoc
Return values
bool

isFolder()

Checks if the file stream API object is a folder.

public isFolder() : bool
Tags
inheritDoc
Return values
bool

isLocal()

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

public isLocal() : bool
Tags
inheritDoc
Return values
bool

isReadableStream()

Checks if the stream is readable.

public isReadableStream() : bool
Tags
inheritDoc
Return values
bool

isSeekableStream()

Checks if the stream is seekable.

public isSeekableStream() : bool
Tags
inheritDoc
Return values
bool

isWritableStream()

Checks if the stream is writable.

public isWritableStream() : bool
Tags
inheritDoc
Return values
bool

openStream()

Opens the stream file.

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

The target stream mode

Tags
inheritDoc
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
inheritDoc
Return values
string

rewindStream()

Rewinds the stream file API object.

public rewindStream() : void
Tags
inheritDoc
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
inheritDoc
Return values
void

setContentFromPath()

Sets the content from a given file path.

public final setContentFromPath(string $sFilePath) : bool
Parameters
$sFilePath : string

The path of the file where we get the content to write.

Tags
Return values
bool

setContentFromStream()

Sets the content from a given stream file API object.

public final setContentFromStream(CSFileStream $oFileStream) : bool
Parameters
$oFileStream : CSFileStream

The stream file API object where we get the content to write.

Tags
Return values
bool

setContentFromString()

Sets the content from string content.

public final setContentFromString(string $sContent) : bool
Parameters
$sContent : string

The content, which should be set to the stream file API object

Tags
Return values
bool

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
inheritDoc
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
inheritDoc
Return values
int|false

        

Search results