Zum Hauptinhalt springen

Zymba Documentation

IO.FileStream

Text
object @IO.FileStream(@IO.Stream) {
MODE_CREATE;
MODE_TRUNCATE;
MODE_APPEND;
MODE_OVERWRITE;
construct(string $path, int $mode) {}
attemptLock(): bool {}
attemptLockShared(): bool {}
canLock(): bool {}
getSize(): int {}
lock(): $this {}
lockShared(): $this {}
pad(int $size, string $padding): int {}
selectLock(): object {}
sync(): bool {}
syncData(): bool {}
unlock(): $this {}
}

IO file stream prototype.

Prototype

IO.Stream

Methods

Opens a stream to a file in a specific access mode (see MODE_* constants).

CODE
$this.construct(string $path, int $mode): void
Parameters
NameTypeValueDefault
pathstring""
modeintMODE_READ
CODE
$this.attemptLock(): bool
Returns
TypeValue
bool
CODE
$this.attemptLockShared(): bool
Returns
TypeValue
bool

Determines whether this stream can be locked.

CODE
$this.canLock(): bool
Returns
TypeValue
bool

Gets the size of this stream in number of bytes.

CODE
$this.getSize(): int
Returns
TypeValue
int
CODE
$this.lock(): this
Returns
TypeValue
$this
CODE
$this.lockShared(): this
Returns
TypeValue
$this

Pads the content of this stream to a specific size in number of bytes by repeatedly appending it with a specific padding string and returns the number of bytes written.

CODE
$this.pad(int $size, string $padding): int
Parameters
NameTypeValueDefault
sizeint0
paddingstring"\x00"
Returns
TypeValue
int
CODE
$this.selectLock(): @IO.LockContext
Returns
TypeValue
@IO.LockContext

Synchonizes this stream with the underlying storage device, including modified metadata.

CODE
$this.sync(): bool
Returns
TypeValue
bool

Synchonizes this stream with the underlying storage device, excluding modified metadata (if possible).

CODE
$this.syncData(): bool
Returns
TypeValue
bool
CODE
$this.unlock(): this
Returns
TypeValue
$this