\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
\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
\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