To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationSequentialFile object

Introduction

ZPE 1.6.7 (November 2018) added the SequentialFile object, a built-in object that allows manipulation of files line by line or character by character.

This new object is fast when it comes to reading line by line or character by character and it exposes to certain functionalities.

SequentialFile object functions

The following is a list of internal functions the SequentialFile object exposes. All functions are ZPEObjectNativeFunctions unless specified therefore run in native code.

has_next () ⇒ boolean
Determines if there is another line or character in the sequence.
read_line () ⇒ string
Reads the next line in the sequence.
open (string file) ⇒ boolean
Opens a new file. Added in version 1.7.5.
get_current () ⇒ string
Returns the current string within the buffer. Added in version 1.7.6.

Examples in action

The following example reads some text file line by line.

YASS
$f = new SequentialFile()
$f->open("list.txt")

while ($f->has_next())
  print($f->read_line())
end while
    
The SequentialFile uses file IO tools and requires permission level 4. Since it is the case with all objects, the object will generate correctly and seem like it is working but will not actually be able to open the file to read it.

The file_open_sequentially function

Before its removal in version 1.7.5, the built-in file_open_sequentially function generated a new SequentialFile object. This can be stored in a variable and referenced later using the object syntaxes.

Comments

There are no comments on this page.

New comment
Reply
Feedback 👍
Comments are sent via email to me.