]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Compress class.\r | |
3 | \r | |
4 | This class is to call CompressDll.dll to compress section.\r | |
5 | \r | |
6 | Copyright (c) 2006, Intel Corporation\r | |
7 | All rights reserved. This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | package org.tianocore.framework.tasks;\r | |
18 | \r | |
19 | import java.io.File;\r | |
20 | \r | |
21 | /**\r | |
22 | \r | |
23 | This class is to call CompressDll.dll to compress section.\r | |
24 | \r | |
25 | **/\r | |
26 | public class Compress {\r | |
27 | byte[] inputBuffer;\r | |
28 | byte[] outputBuffer;\r | |
29 | int size;\r | |
30 | \r | |
31 | static {\r | |
32 | String dllPath;\r | |
33 | \r | |
34 | dllPath = GenFfsFileTask.path;\r | |
35 | dllPath = dllPath + \r | |
36 | File.separator + \r | |
37 | "CompressDll.dll";\r | |
38 | \r | |
39 | System.load(dllPath);\r | |
40 | }\r | |
41 | \r | |
42 | /**\r | |
43 | CallCompress\r | |
44 | \r | |
45 | This function is to call the compressDll.dll to compress the contents in\r | |
46 | buffer.\r | |
47 | \r | |
48 | @param inputBuffer The input buffer.\r | |
49 | @param size The size of buffer in byte.\r | |
50 | @param dllPath The compressDll.dll path.\r | |
51 | @return The buffer contained the comrpessed input.\r | |
52 | **/\r | |
53 | public native byte[] CallCompress (byte[] inputBuffer, int size, String dllPath);\r | |
54 | \r | |
55 | /**\r | |
56 | Construct function\r | |
57 | \r | |
58 | This function is to initialize the class member and call the compress \r | |
59 | function.\r | |
60 | \r | |
61 | @param inBuffer The input buffer. \r | |
62 | @param size The size of buffer in byte.\r | |
63 | **/\r | |
64 | public Compress (byte[] inBuffer, int size){\r | |
65 | this.inputBuffer = inBuffer;\r | |
66 | this.size = size; \r | |
67 | String path = GenFfsFileTask.path;\r | |
68 | \r | |
69 | //\r | |
70 | // Call Compress function.\r | |
71 | //\r | |
72 | this.outputBuffer = CallCompress (\r | |
73 | this.inputBuffer, \r | |
74 | this.size,\r | |
75 | path \r | |
76 | );\r | |
77 | }\r | |
78 | } |