Learn R Programming

neuroim2 (version 0.8.5)

close,BinaryReader-method: 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 BinaryReader
close(con)

# S4 method for BinaryWriter close(con)

Value

Invisibly returns NULL, called for its side effect of closing the connection.

Arguments

con

The BinaryReader or BinaryWriter object to close.

Examples

Run this code
# \donttest{
# 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)
# }

Run the code above in your browser using DataLab