Posts Tagged ‘AIR’
The last time I introduced the features of “Airxzip”, this post says one of the features.
Change file system and set filemode and directory mode
var writer:ZipFileWriter = new ZipFileWriter(ZipFileWriter.HOST_UNIX);
writer.open(File.desktopDirectory.resolvePath("airxzip_unix.zip"));
writer.setDirMode("0700");
writer.setFileMode("0700");
writer.addDirectory("Foo1");
writer.addFile(File.desktopDirectory.resolvePath("image.jpg"),"Foo2/image.jpg");
writer.setFileMode("0766");
writer.addFile(File.desktopDirectory.resolvePath("image.jpg"),"Foo3/image.jpg");
writer.close();
unzip -Z airxzip_unix.zip Archive: airxzip_unix.zip 1550668 bytes 3 files drwx------ 1.0 unx 0 b- stor 6-May-10 20:11 Foo1/ -rwx------ 2.0 unx 777835 b- defN 14-Jul-09 14:32 Foo2/image.jpg -rwxrw-rw- 2.0 unx 777835 b- defN 14-Jul-09 14:32 Foo3/image.jpg
Default filetype is “ZipFileWriter.HOST_WIN”.
So If you want to create zip file for Mac or Unix/Linux , Please set “ZipFileWriter.HOST_UNIX”.
var writer:ZipFileWriter = new ZipFileWriter(ZipFileWriter.HOST_UNIX);
Default file system
unzip -Z async_airxzip.zip Archive: async_airxzip.zip 775492 bytes 3 files -rw-a-- 2.0 fat 6 b- defN 6-May-10 20:12 sample.txt drwx--- 1.0 fat 0 b- stor 6-May-10 20:12 Foo1/ -rw-a-- 2.0 fat 777835 b- defN 14-Jul-09 14:32 Foo1/image.jpg
Airxzip
Airxzip is a library in ActionScript3 (AIR).
Fzip is ActionScript3 library too.
But I have some problems to use it.
So I made “Airxzip”.
Airxzip has following features …
1) Specialize in AIR
It becomes possible for the access to begin at the end of the file ( zip entry infomations ),
It does not to depend on the size of zip file.
So It is able to access information quickly.
2) Async upzip
Airxzip has 2 unzip method. ( unzip() and unzipAsync() )
3) PKWare encrypt/decrypt
4) File attribute ( Zip mode only)
Enable to set file attirbute.
ex) “0700″ “0755″
5) Japanese filename
Mac OS and Unix filename is UTF-8, Windows is Shift_JIS.
And Mac OS UTF-8 and Unix UTF-8 is not same to handle Hankaku-kana.
So AIrxzip resolve these difference automatically.
Project Site
Sample codes
The sample code for google gmail buzz using airxmail ( as3 smtp/pop library)
sender = new SMTPSender();
sender.setParameter(SMTPSender.HOST,"smtp.gmail.com");
sender.setParameter(SMTPSender.PORT,465);
// use SMTP-AUTH
sender.setParameter(SMTPSender.AUTH,true);
sender.setParameter(SMTPSender.USERNAME,username);
sender.setParameter(SMTPSender.PASSWORD,password);
// use STARTTLS
sender.setParameter(SMTPSender.SOCKET_OBJECT,new com.hurlant.crypto.tls.TLSSocket());
// If you want to change the charset for mail header
AirxMailConfig.setDefaultHeaderCharset("UTF-8");
var mimeMsg:MimeMessage = new MimeMessage();
var from:INetAddress = new INetAddress();
from.personal = "coltware";
from.address = this.fromEmail;
mimeMsg.setFrom(from);
var toAddr:INetAddress = new INetAddress("buzz@gmail.com","buzz");
mimeMsg.addRcpt(RecipientType.TO,toAddr);
// set mail subject
mimeMsg.setSubject("My first buzz from airxmail");
mimeMsg.setTextBody("");
sender.send(mimeMsg);
sender.close();

