Open - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


FileTools[Compressed]

  

Open

  

open a compressed file for reading or writing

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Open(filename, options)

Parameters

filename

-

string, or string in string

options

-

(optional) argument(s) of the form option=value where option is one of mode, append, format, or gzipopts

Options

• 

mode : READ or WRITE

• 

append : true or false (default); whether to append to an existing file

• 

format : zip or gzip ; specify compression format

• 

gzipopts : additional compression options to pass to zlib see FileTools[Compressed].

Description

• 

The Open command opens a file to be read or written in gzip or zip format. It returns an integer file descriptor that can be passed to most of the commands in the subpackage FileTools[Compressed].

• 

If filename is the name of an existing file, the file is opened for reading unless the append option is passed or the option mode is set to WRITE.  If mode=WRITE is given, filename will be overwritten unless the option append is also given.

• 

If filename is not an existing file, then it will be opened for writing.

• 

The format will be implicitly determined by the filename -- if the suffix is ".zip", ".ZIP" or if filename is of the form "subfile" in "zipfile", then the system will assume the file is in zip format.  Otherwise it will be opened as if it were in gzip format.  The format=gzip or format=zip option can be used to force the recognition of a specified format.

Examples

fileFileToolsTemporaryFilenameFileToolsJoinPathFileToolsTemporaryDirectory,GZtest-

file/tmp/mpldoc3/GZtest-yYoYxV9R

(1)

fdFileToolsCompressedOpenfile

fd25364016

(2)

FileToolsCompressedClosefd

0

(3)

FileToolsCompressedOpenfile

25364016

(4)

FileToolsCompressedOpenfile

Error, (in FileTools:-Compressed:-Open) file /tmp/mpldoc3/GZtest-yYoYxV9R is already open

FileToolsCompressedClosefile

0

(5)

Compatibility

• 

The FileTools[Compressed][Open] command was introduced in Maple 16.

• 

For more information on Maple 16 changes, see Updates in Maple 16.

• 

The format option was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

FileTools[Compressed]

FileTools[Compressed][Close]

FileTools[Compressed][Read]

FileTools[Compressed][Write]

FileTools[Remove]