close,BinaryReader-method {neuroim2} | R Documentation |
Close a BinaryReader or BinaryWriter
Description
Closes the underlying connection associated with a BinaryReader or BinaryWriter object. This should be called when you're done with the reader/writer to free system resources.
Usage
## S4 method for signature 'BinaryReader'
close(con)
## S4 method for signature 'BinaryWriter'
close(con)
Arguments
con |
The BinaryReader or BinaryWriter object to close. |
Value
Invisibly returns NULL
, called for its side effect of closing the connection.
Examples
# Create a temporary file and write some data
tmp <- tempfile()
writer <- BinaryWriter(tmp, byte_offset = 0L,
data_type = "DOUBLE", bytes_per_element = 8L)
write_elements(writer, rnorm(100))
close(writer)
# Read the data back
reader <- BinaryReader(tmp, byte_offset = 0L,
data_type = "DOUBLE", bytes_per_element = 8L)
data <- read_elements(reader, 100)
close(reader)
# Clean up
unlink(tmp)
[Package neuroim2 version 0.8.1 Index]