API version 1

- ‐

convert

圧縮データを解凍します。

Compressor クラスで圧縮されたデータを直接圧縮前のデータに変換することができます。

呼出形式一覧

呼出形式

説明

binary convert(binary data)

圧縮データを解凍します。

戻り値一覧

戻り値

説明

binary

解凍された結果データ

引数一覧

引数

説明

data

Compressorクラスで圧縮されたバイナリデータ

例外

なし



使用例 CRSダウンロード

Form Comp_Decomp {
   X = 0;
   Y = 0;
   Width = 765;
   Height = 494;

   String dirName = "/Compressor";
   String fName = "file1.txt";

   Button btn_makesample1 {
           x = 15;
           y = 17;
           width = 180;
           Height = 35;
           Title = "サンプルファイル(圧縮)作成";

           Function OnTouch(e) {
                   try {
                           var fs = new FileSystem(FileSystem.PUBLIC_ROOT);

                           if ( fs.Exists( ^.dirName ) ) {
                                   fs.DeleteFile(^.dirName,FileSystem.NOCONFIRM);
                           }

                           fs.CreateFolder(^.dirName);

                           var fp = fs.Open(^.dirName + "/" + ^.fName, FileSystem.OPEN_WRITE );
                var enc = Compressor.Convert("★★english★★\r\n★★漢字表現★★\r\n★★あいうえお★★\r\n★★アイウエオ★★\r\n★★アイウエオ★★\r\n★★123456★★\r\n★★#$%&()★★");
                fp.write(enc);
                           fp.Close();
                   }
                   catch(e) {
                           ^.EditBox1.Value = "Message=" + str(e.Message) + "\r\nCategory=" + str(e.Category) + "\r\nCode="+ str(e.Code)  + "\r\nSubCode=" + str(e.subCode);
                   }               }
   }
   Button btn_Editor {
           x = 229;
           y = 43;
           width = 94;
           height = 26;
           Title = "エディタで開く";
           Function OnTouch(e) {
                   Runtime rt;
                   rt.ShellOpen(^.dirName + "/" + ^.fName);
           }
   }
   TextBox txt_filename1 {
           x = 230;
           y = 15;
           Width = 94;
           Height = 21;
           Value = ^.fName;
   }
   Button Button4 {
           x = 265;
           y = 110;
           Width = 66;
           Height = 35;
           Title = "Clear";

           Function OnTouch( e ) {
                   ^.EditBox1.Value = "";
           }
   }

   EditBox EditBox1 {
           x = 15;
           y = 150;
           width = 315;
           height = 146;
   }

   Button btn_Open1 {
           x = 15;
           y = 109;
           width = 180;
           Height = 35;
           Title = "New Decompressor(解凍)";

           Function OnTouch( e ) {
                   var outBuff;
                   var fs = new FileSystem();
                   var fp = fs.open(^.dirName + "/" + ^.fName, FileSystem.OPEN_READ);

                   try {
                           var txt = new Decompressor(fp);
                           outBuff = txt.Read();
                           txt.Close();
                           ^.EditBox1.Value = outBuff;
                   }
                   catch(e) {
                           ^.EditBox1.Value = "Message=" + str(e.Message) + "\r\nCategory=" + str(e.Category) + "\r\nCode="+ str(e.Code)  + "\r\nSubCode=" + str(e.subCode);
                   }
           }
   }

}