Add a CloseAction to the end of the CloseAction queue (the last action executed).
Add a CloseAction to the end of the CloseAction queue (the last action executed).
The new action to append
a new instance with the added CloseAction
Creates a CloseAction from the function and passes it to appendCloseAction(CloseAction)
Creates a CloseAction from the function and passes it to appendCloseAction(CloseAction)
The new action to append
a new instance with the added CloseAction
Creates a new instance of the underlying resource (or opens it).
Creates a new instance of the underlying resource (or opens it). Sometimes the code block used to create the Resource is non-reusable in which case this Resource can only be used once. This is not recommended. When creating a resource it is recommended to pass the code block for creating the resource to the resource so that the resource can be reused. Of course this is not always possible
This method should only be used with care in cases when Automatic
Resource Management cannot be used because the
InputStream
must be closed manually.
This is public only to permit interoperability with certain Java APIs. A better pattern of use should be:
resource.acquireFor { // call java API }
or
val calculatedResult = resource.acquireAndGet { // cal java API that returns a result }
the actual resource that has been opened
Execute the function 'f' passing an WriteChars instance that performs all operations on a single opened connection to the underlying resource.
Execute the function 'f' passing an WriteChars instance that performs all operations on a single opened connection to the underlying resource. Typically each call to one of the Output's methods results in a new connection. For example if the underlying OutputStream truncates the file each time the connection is made then calling write two times will result in the contents of the second write overwriting the second write.
Even if the underlying resource is an appending, using open will be more efficient since the connection only needs to be made a single time.
the function to execute on the new Output instance (which uses a single connection)
the result of the function
Add a CloseAction to the front of the CloseAction queue.
Add a CloseAction to the front of the CloseAction queue.
The new action to prepend
a new instance with the added CloseAction
Creates a CloseAction from the function and passes it to prependCloseAction(CloseAction)
Creates a CloseAction from the function and passes it to prependCloseAction(CloseAction)
The new action to prepend
a new instance with the added CloseAction
Write several characters to the underlying object
Write several characters to the underlying object
Write several strings.
Write several strings. The open options that can be used are dependent on the implementation and implementors should clearly document which option are permitted.
The data to write
A string to add between each string. It is not added to the before the first string or after the last.
A ManagedResource for accessing and using Writers. Class can be created using the Resource object.