X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkTasks%2Forg%2Ftianocore%2Fframework%2Ftasks%2FSectFile.java;h=c110f3bc50b27f8e6cfd34bca66a7ee654daf8ab;hp=b603a3eb80a92b84af3af0e0475796d4d78f395d;hb=87379bbecf036195249649680b958e501dc952a5;hpb=9c7790d2cb87584ac2a844f0757142edebd35f71 diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java index b603a3eb80..c110f3bc50 100644 --- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java +++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java @@ -53,10 +53,9 @@ public class SectFile implements Section { @param Buffer buffer to contain the section file content with alignment **/ - public void toBuffer (DataOutputStream buffer, DataOutputStream orgBuffer){ + public void toBuffer (DataOutputStream buffer){ File sectFile; - byte data; - long fileLen; + int fileLen; /// /// open file @@ -67,7 +66,7 @@ public class SectFile implements Section { /// check if file exist. /// if (! sectFile.exists()) { - throw new BuildException("The file " + this.fileName + " does not exist!\n"); + throw new BuildException("The file " + this.fileName + " is not exist!\n"); } @@ -78,18 +77,10 @@ public class SectFile implements Section { FileInputStream fs = new FileInputStream (sectFile.getAbsoluteFile()); DataInputStream In = new DataInputStream (fs); - fileLen = sectFile.length(); - - int i = 0; - while (i < fileLen) { - data = In.readByte(); - buffer.writeByte(data); - // - // Add data to org file - // - orgBuffer.writeByte(data); - i++; - } + fileLen = (int)sectFile.length(); + byte[] sectBuffer = new byte[fileLen]; + In.read(sectBuffer); + buffer.write(sectBuffer); /// /// 4 byte alignment @@ -97,10 +88,6 @@ public class SectFile implements Section { while ((fileLen & 0x03)!= 0) { fileLen ++; buffer.writeByte(0); - // - // Add data to org file - // - orgBuffer.writeByte(0); } /// @@ -113,4 +100,4 @@ public class SectFile implements Section { throw new BuildException("SectFile, toBuffer failed!\n"); } } -} +} \ No newline at end of file