AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
closeEntry (Stream stream) yoix.io
 
Closes the currently open entry when stream is a sequentially accessed zipped stream. When reading, the stream is advanced to the next entry. When writing, any buffered output is flushed and the entry is closed. Returns 0 on success or -1 if there was an error or there was no entry to close.
 
 Example:   The following script opens a jar or zip file and displays each of its ZipEntry elements and the first line of the associated entry data. Refer to the ZipEntry documentation for a related example.
import yoix.io.*;
import yoix.stdio.*;
import yoix.string.*;
import yoix.util.*;

File f = {
    String name = argc > 1 ? argv[1] : "test.jar";
    int mode = READ;
    int filters = argc > 2 ? atoi(argv[2]) : ZIPPED;
    int open = TRUE;
};

ZipEntry ze;
String data;

while(ze = f.nextentry) {
    fprintf(stdout, "name=%s\n", ze.name);
    fprintf(stdout, "\tcomment=%s\n", ze.comment);
    fprintf(stdout, "\tcompressedsize=%d\n", ze.compressedsize);
    fprintf(stdout, "\tcrc=%d\n", ze.crc);
    fprintf(stdout, "\tdeflated=%d\n", ze.deflated);
    fprintf(stdout, "\textra=%s\n", ze.extra);
    fprintf(stdout, "\tsize=%d\n", ze.size);
    fprintf(stdout, "\ttimestamp=%s\n", date(ze.timestamp));
    stdout.nextline = "==========";
    if(data = f.nextline)
	stdout.nextline = data;
    stdout.nextline = "==========";
    closeEntry(f);
}

f.open = FALSE;
 
 Return:   int
 
 See Also:   close, ZipEntry

 

Yoix is a registered trademark of AT&T Inc.