]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / CompressSection.java
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
deleted file mode 100644 (file)
index 5f35685..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/** @file\r
- CompressSection class.\r
-\r
- CompressSection indicate that all section which in it should be compressed.\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
-\r
-package org.tianocore.framework.tasks;\r
-\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.DataOutputStream;\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-\r
-\r
-/**\r
-  CompressSection\r
-  \r
-  CompressSection indicate that all section which in it should be compressed. \r
\r
-**/\r
-public class CompressSection implements Section, FfsTypes {\r
-    //\r
-    // The attribute of compressName.\r
-    //\r
-    private String compressName = "";\r
-    //\r
-    // The list contained the SectFile element.\r
-    //\r
-    private List<Section> sectList = new ArrayList<Section>();\r
-\r
-    public static Object semaphore = new Object();\r
-    /**\r
-      toBuffer\r
-      \r
-      This function is to collect all sectFile and compress it , then output\r
-      the result to buffer.\r
-      \r
-      @param Buffer     The point of output buffer\r
-      \r
-    **/\r
-    public void toBuffer (DataOutputStream buffer){\r
-        \r
-        Section    sect;\r
-    \r
-        //\r
-        //  Get section file in compress node.\r
-        //\r
-        try{\r
-            \r
-            ByteArrayOutputStream bo = new ByteArrayOutputStream ();\r
-            DataOutputStream Do = new DataOutputStream (bo);\r
-            \r
-            //\r
-            //  Get each section which under the compress {};\r
-            //  And add it is contains to File;\r
-            //\r
-            Iterator SectionIter = sectList.iterator();\r
-            while (SectionIter.hasNext()){\r
-                sect = (Section)SectionIter.next();\r
-                \r
-                //\r
-                //  Call each section class's toBuffer function.\r
-                //\r
-                try {\r
-                    sect.toBuffer(Do);\r
-                }\r
-                catch (BuildException e) {\r
-                    System.out.print(e.getMessage());\r
-                    throw new BuildException ("Compress.toBuffer failed at section");\r
-                }    \r
-                            \r
-            }\r
-            Do.close();    \r
-            \r
-            synchronized (semaphore) {\r
-            //\r
-            //  Call compress\r
-            //\r
-            byte[] fileBuffer = bo.toByteArray();\r
-            Compress myCompress = new Compress(fileBuffer, fileBuffer.length);            \r
-            \r
-            //\r
-            //  Add Compress header\r
-            //\r
-            CompressHeader Ch        = new CompressHeader();\r
-            Ch.SectionHeader.Size[0] = (byte)((myCompress.outputBuffer.length +\r
-                                               Ch.GetSize()) &\r
-                                               0xff\r
-                                              );\r
-            Ch.SectionHeader.Size[1] = (byte)(((myCompress.outputBuffer.length + \r
-                                                Ch.GetSize())&\r
-                                               0xff00) >> 8\r
-                                              );\r
-            Ch.SectionHeader.Size[2] = (byte)(((myCompress.outputBuffer.length + \r
-                                                Ch.GetSize()) & \r
-                                               0xff0000) >> 16\r
-                                             );\r
-            Ch.SectionHeader.type    = (byte) EFI_SECTION_COMPRESSION;\r
-            \r
-            //\r
-            //  Note: The compressName was not efsfective now. Using the\r
-            //  EFI_STANDARD_COMPRSSION for compressType .\r
-            //  That is follow old Genffsfile tools. Some code will be added for \r
-            //  the different compressName;\r
-            //\r
-            Ch.UncompressLen         = fileBuffer.length;\r
-            Ch.CompressType          = EFI_STANDARD_COMPRESSION; \r
-            \r
-            //\r
-            //  Change header struct to byte buffer\r
-            //\r
-            byte [] headerBuffer = new byte[Ch.GetSize()];\r
-            Ch.StructToBuffer(headerBuffer);\r
-            \r
-            //\r
-            //  First add CompressHeader to Buffer, then add Compress data.\r
-            //\r
-            buffer.write (headerBuffer);\r
-            buffer.write(myCompress.outputBuffer);            \r
-                \r
-            //\r
-            //  Buffer 4 Byte aligment \r
-            //\r
-            int size = Ch.GetSize() + myCompress.outputBuffer.length;\r
-            \r
-            while ((size & 0x03) != 0){\r
-                size ++;\r
-                buffer.writeByte(0);\r
-            }\r
-            //\r
-            //  Delete temp file\r
-            //\r
-            //di.close();\r
-            //compressOut.delete();\r
-            }\r
-                \r
-        }\r
-        catch (Exception e){\r
-            throw new BuildException("compress.toBuffer failed!\n");\r
-        }    \r
-    }\r
-\r
-    /**\r
-      getCompressName\r
-      \r
-      This function is to get compressName.\r
-      \r
-      @return            The compressName.\r
-    **/\r
-    public String getCompressName() {\r
-        return compressName;\r
-    }\r
-\r
-    /**\r
-      setCompressName\r
-      \r
-      This function is to set compressName.\r
-      \r
-      @param compressName The string of compressName\r
-    **/\r
-    public void setCompressName(String compressName) {\r
-        this.compressName = compressName;\r
-    }\r
-\r
-    /**\r
-      addSectFile\r
-      \r
-      This function is to add sectFile element to SectList.\r
-      \r
-      @param sectFile    SectFile element which succeed from section class.\r
-    **/\r
-    public void addSectFile (SectFile sectFile) {\r
-        sectList.add(sectFile);\r
-            \r
-    }    \r
-    \r
-    /**\r
-      addTool\r
-      \r
-      This function is to add tool element to SectList.\r
-      @param tool        Tool element which succeed from section class.\r
-    **/\r
-    public void addTool (Tool tool) {\r
-        sectList.add(tool);\r
-    }\r
-}
\ No newline at end of file