All Downloads are FREE. Search and download functionalities are using the official Maven repository.

reference.language.write.html Maven / Gradle / Ivy




    
    Write statements
    
    

    
    

    
    

    
    
    
    

    


Write statements

Write expressions are used to write content to a resource such as a file or a web site.

Writing the entire content to an inlined resource

Writing the entire content to a resource can be achieved using an inlined resource.
An inlined resource is initialized directly within a write statement.
This is very useful for small files or small messages sent to outgoing network connections.
It is however impossible to demonstrate within a browser, where programmatic access to local files is prohibited for security reasons.
In the below example, we write to an inlined Buffer instead.
( the Buffer only exists during the execution of the statement, and therefore it cannot be read back to display its content )

Writing content line by line to a managed resource

Writing content line by line to a resource can be achieved using a managed resource.
A managed resource is initialized through a with clause followed by do and a list of statements.
The resource is said to be managed because Prompto will take care of resource cleanup when it exits the statements controlled by the with clause.

It is illegal to call write or read on a resource which is neither managed nor inlined.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy