Input/Output

Input/Output

The functions and types defined here facilitate writing to STDOUT and STDERR as well as files. In particular, performance tests have shown that buffering is important when running in parallel. To this end, the BufferedIO type is introduced that stores output in an in-memory buffer before writing to an underlying stream. This can create some difficulty when debuging, because output written to a buffered stream is not immediately written to the underlying stream. In cases where precise control of output is needed, users should call flush to make sure all output is written to the underlying stream

Detailed Documentation

Utils.BSTDERRConstant.

Buffered version of STDERR. This should always be used instead of STDERR

source
Utils.BSTDOUTConstant.

Buffered version of STDOUT. This should always be used instead of STDOUT

source

Utils.BufferedIO

This type provides a means to buffer IO in memory before writing it to a file. Data written to the object is stored in the IOBuffer until flush() is called, when the buffer is (efficiently) dumped into the file

source

Alternative constructor for BufferedIO, emulating the open() function. This function creates the underlying file using open() and then creates a BufferedIO around it.

Inputs:

fname: AbstractString, name of file to open
mode: file open mode, see documentation of open(), defaults to append

Outputs:

a BufferedIO object
source

Utils.BufferedIO

Constructor for BufferedIO type. Takes an IOStream and creates an IOBuffer. If no IOStream is given, a dummy stream is created. If a dummy stream is used, flush must never be called on the returned BufferedIO object

Inputs:

f: an IOStream object, defaults to a dummy stream

Outputs:

a BufferedIO object
source
Base.closeMethod.

Base function close extended for BufferedIO

source
Base.flushMethod.

Base function flush extended for BufferedIO

source