]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java
Modify GenFfsTask to make it don't create ORG file.
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / SectFile.java
index b603a3eb80a92b84af3af0e0475796d4d78f395d..c110f3bc50b27f8e6cfd34bca66a7ee654daf8ab 100644 (file)
@@ -53,10 +53,9 @@ public class SectFile implements Section {
   \r
      @param   Buffer  buffer to contain the section file content with alignment\r
      **/\r
   \r
      @param   Buffer  buffer to contain the section file content with alignment\r
      **/\r
-    public void toBuffer (DataOutputStream buffer, DataOutputStream orgBuffer){\r
+    public void toBuffer (DataOutputStream buffer){\r
         File   sectFile;\r
         File   sectFile;\r
-        byte   data;\r
-        long   fileLen;\r
+        int    fileLen;\r
 \r
         ///\r
         /// open file\r
 \r
         ///\r
         /// open file\r
@@ -67,7 +66,7 @@ public class SectFile implements Section {
         /// check if file exist.\r
         ///     \r
         if (! sectFile.exists()) {\r
         /// check if file exist.\r
         ///     \r
         if (! sectFile.exists()) {\r
-            throw new BuildException("The file  " + this.fileName + "  does not exist!\n");     \r
+            throw new BuildException("The file  " + this.fileName + "  is not exist!\n");     \r
         }\r
 \r
 \r
         }\r
 \r
 \r
@@ -78,18 +77,10 @@ public class SectFile implements Section {
 \r
             FileInputStream fs = new FileInputStream (sectFile.getAbsoluteFile());\r
             DataInputStream In = new DataInputStream (fs);\r
 \r
             FileInputStream fs = new FileInputStream (sectFile.getAbsoluteFile());\r
             DataInputStream In = new DataInputStream (fs);\r
-            fileLen            = sectFile.length();\r
-\r
-            int i = 0;\r
-            while (i < fileLen) {\r
-                data = In.readByte();\r
-                buffer.writeByte(data);\r
-                //\r
-                // Add data to org file \r
-                //\r
-                orgBuffer.writeByte(data);\r
-                i++;\r
-            }\r
+            fileLen            = (int)sectFile.length();\r
+            byte[] sectBuffer  = new byte[fileLen];\r
+            In.read(sectBuffer);\r
+            buffer.write(sectBuffer);\r
 \r
             ///\r
             /// 4 byte alignment\r
 \r
             ///\r
             /// 4 byte alignment\r
@@ -97,10 +88,6 @@ public class SectFile implements Section {
             while ((fileLen & 0x03)!= 0) {\r
                 fileLen ++;\r
                 buffer.writeByte(0);\r
             while ((fileLen & 0x03)!= 0) {\r
                 fileLen ++;\r
                 buffer.writeByte(0);\r
-                //\r
-                // Add data to org file \r
-                //\r
-                orgBuffer.writeByte(0);\r
             } \r
 \r
             ///\r
             } \r
 \r
             ///\r
@@ -113,4 +100,4 @@ public class SectFile implements Section {
             throw new BuildException("SectFile, toBuffer failed!\n");            \r
         }\r
     }\r
             throw new BuildException("SectFile, toBuffer failed!\n");            \r
         }\r
     }\r
-}\r
+}
\ No newline at end of file