FileTools[Compressed] - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : File Manipulation : FileTools : FileTools/Compressed/Open

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

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 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

fileFileTools[TemporaryFilename]catFileTools[TemporaryDirectory],kerneloptsdirsep,GZtest-

file:=/mnt/tmpfs/mpldoc_slot4/mpldoc2/GZtest-yYoYxV9R

(1)

fdFileTools[Compressed][Open]file

fd:=23142624

(2)

FileTools[Compressed][Close]fd

0

(3)

FileTools[Compressed][Open]file

23362064

(4)

FileTools[Compressed][Open]file

Error, (in FileTools:-Compressed:-Open) file /mnt/tmpfs/mpldoc_slot4/mpldoc2/GZtest-yYoYxV9R is already open

FileTools[Compressed][Close]file

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]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam