]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / FrameworkTasks / org / tianocore / framework / tasks / Compress.java
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java
new file mode 100644 (file)
index 0000000..4410ecd
--- /dev/null
@@ -0,0 +1,78 @@
+/** @file\r
+ Compress class.\r
+\r
+ This class is to call CompressDll.dll to compress section.\r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+/**\r
+\r
+  This class is to call CompressDll.dll to compress section.\r
\r
+**/\r
+public class Compress {\r
+    byte[] inputBuffer;\r
+    byte[] outputBuffer;\r
+    int    size;\r
+\r
+    static {\r
+        String dllPath;\r
+\r
+        dllPath = GenFfsFileTask.path;\r
+        dllPath = dllPath + \r
+                  File.separator + \r
+                  "CompressDll.dll";\r
+\r
+        System.load(dllPath);\r
+    }\r
+\r
+    /**\r
+      CallCompress\r
+    \r
+      This function is to call the compressDll.dll to compress the contents in\r
+      buffer.\r
+      \r
+      @param  inputBuffer       The input buffer.\r
+      @param  size              The size of buffer in byte.\r
+      @param  dllPath           The compressDll.dll path.\r
+      @return                   The buffer contained the comrpessed input.\r
+    **/\r
+    public native byte[] CallCompress (byte[] inputBuffer, int size, String dllPath);\r
+\r
+    /**\r
+      Construct function\r
+      \r
+      This function is to initialize the class member and call the compress \r
+      function.\r
+      \r
+      @param inBuffer           The input buffer.         \r
+      @param size               The size of buffer in byte.\r
+    **/\r
+    public Compress (byte[] inBuffer, int size){\r
+        this.inputBuffer   = inBuffer;\r
+        this.size          = size;        \r
+        String path        = GenFfsFileTask.path;\r
+\r
+        //\r
+        //  Call Compress function.\r
+        //\r
+        this.outputBuffer  = CallCompress (\r
+                                          this.inputBuffer, \r
+                                          this.size,\r
+                                          path                          \r
+                                          );\r
+    }\r
+}
\ No newline at end of file