]> 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 35576478d11e423bf25ea8c2d353e02c1ec7758d..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
-    public void toBuffer (DataOutputStream Buffer){\r
+    public void toBuffer (DataOutputStream buffer){\r
         File   sectFile;\r
-        byte   data;\r
-        long   fileLen;\r
+        int    fileLen;\r
 \r
         ///\r
         /// open file\r
@@ -78,21 +77,17 @@ public class SectFile implements Section {
 \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
-                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
             while ((fileLen & 0x03)!= 0) {\r
                 fileLen ++;\r
-                Buffer.writeByte(0);\r
+                buffer.writeByte(0);\r
             } \r
 \r
             ///\r
@@ -102,7 +97,7 @@ public class SectFile implements Section {
 \r
         } catch (Exception e) {\r
             System.out.print(e.getMessage());\r
-            throw new BuildException("section file2Buffer failed!\n");            \r
+            throw new BuildException("SectFile, toBuffer failed!\n");            \r
         }\r
     }\r
 }
\ No newline at end of file