\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
- byte data;\r
- long fileLen;\r
+ int fileLen;\r
\r
///\r
/// open file\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
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
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
throw new BuildException("SectFile, toBuffer failed!\n"); \r
}\r
}\r
-}\r
+}
\ No newline at end of file