4 GenFfsFileTaks is to generate ffs file.
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.framework
.tasks
;
18 import java
.io
.DataInputStream
;
19 import java
.io
.DataOutputStream
;
21 import java
.io
.FileInputStream
;
22 import java
.io
.FileOutputStream
;
23 import java
.util
.ArrayList
;
24 import java
.util
.Iterator
;
25 import java
.util
.List
;
27 import org
.apache
.tools
.ant
.BuildException
;
28 import org
.apache
.tools
.ant
.Project
;
29 import org
.apache
.tools
.ant
.Task
;
34 GenFfsFileTaks is to generate ffs file.
37 public class GenFfsFileTask
extends Task
implements EfiDefine
, FfsTypes
{
39 * GenFfsFile Task Class
41 * -baseName : module baseName
42 * -ffsFileGuid : module Guid.
43 * -ffsFileType : Ffs file type.
44 * -ffsAttributeRecovery : The file is required for recovery.
45 * -ffsAligment : The file data alignment (0 if none required). See FFS
46 * specification for supported alignments (0-7 are only possible
48 * -ffsAttributeCheckSum : The file data is checksummed. If this is FALSE a
49 * value of 0x5A will be inserted in the file
50 * checksum field of the file header. *
51 * -sectFileDir : specifies the full path to the component build directory.
53 * -ffsAttrib : Data recorde attribute added result.
54 * -sectionList : List recorded all section elemet in task.
63 String ffsFileGuid
= "";
67 String ffsFileType
= "";
69 /// ffsAttribHeaderExtension value is used to set the corresponding bit in
70 /// the output FFS file header
72 boolean ffsAttribHeaderExtension
= false;
74 /// ffsAttribTailPresent value is used to set the corresponding bit in the
75 /// output FFS file header
77 boolean ffsAttribTailPresent
= false;
79 /// ffsAttribRecovery value is used to set the corresponding bit in the
80 /// output FFS file header
82 boolean ffsAttribRecovery
= false;
84 /// ffsAligenment value is used to set the corresponding bit in the output
85 /// FFS file header.The specified FFS alignment must be a value between 0
90 /// ffsAttribChecksum value is used to set the corresponding bit in the
91 /// output FFS file header
93 boolean FfsAttribChecksum
= false;
95 /// Attribute is used to record the sum of all bit in the output FFS file.
99 /// The output directory of ffs file.
101 String outputDir
= "";
105 List
<Object
> sectionList
= new ArrayList
<Object
>();
108 /// The path of Framewor_Tools_Paht.
110 static String path
= "";
115 GenFfsFileTask execute is to generate ffs file according to input section
116 dscriptive information.
118 public void execute() throws BuildException
{
126 FfsHeader ffsHeader
= new FfsHeader();
127 FfsHeader orgFfsHeader
= new FfsHeader();
128 String ffsSuffix
= "";
129 String outputPath
= "";
132 // Get Fraemwork_Tools_Path
134 Project pj
= this.getOwningTarget().getProject();
135 path
= pj
.getProperty("env.FRAMEWORK_TOOLS_PATH");
138 // Check does the BaseName, Guid, FileType set value.
140 if (this.baseName
.equals("")) {
141 throw new BuildException ("Must set BaseName!\n");
144 if (this.ffsFileGuid
.equals("")) {
145 throw new BuildException ("Must set ffsFileGuid!\n");
148 if (this.ffsFileType
.equals("")) {
149 throw new BuildException ("Must set ffsFileType!\n");
153 // Create ffs file. File name = FfsFileGuid + BaseName + ffsSuffix.
154 // If outputDir's value was set, file will output to the outputDir.
156 ffsSuffix
= TypeToSuffix (this.ffsFileType
);
157 if (!this.outputDir
.equals("")) {
159 outputPath
= this.outputDir
;
160 temp
= outputPath
.replace('\\', File
.separatorChar
);
161 outputPath
= temp
.replace('/', File
.separatorChar
);
162 if (outputPath
.charAt(outputPath
.length()-1) != File
.separatorChar
) {
163 outputPath
= outputPath
+ File
.separator
;
168 ffsFile
= new File (outputPath
+ this.ffsFileGuid
+ '-' + this.baseName
+ ffsSuffix
);
169 System
.out
.print("General Ffs file: file name is:\n");
170 System
.out
.print(outputPath
+ this.ffsFileGuid
+ '-' + this.baseName
+ ffsSuffix
);
171 System
.out
.print("\n");
174 // Create ffs ORG file. fileName = FfsFileGuid + BaseName + ffsSuffix +
177 ffsOrgFile
= new File(outputPath
+ this.ffsFileGuid
+ '-' + this.baseName
+ ffsSuffix
+ ".org");
181 // Create file output stream -- dataBuffer.
183 FileOutputStream dataFs
= new FileOutputStream (ffsFile
.getAbsolutePath());
184 DataOutputStream dataBuffer
= new DataOutputStream (dataFs
);
187 // Create org file output stream -- orgDataBuffer
189 FileOutputStream orgDataFs
= new FileOutputStream (ffsOrgFile
.getAbsolutePath());
190 DataOutputStream orgDataBuffer
= new DataOutputStream (orgDataFs
);
193 // Search SectionList find earch section and call it's
194 // ToBuffer function.
196 Iterator sectionIter
= this.sectionList
.iterator();
197 while (sectionIter
.hasNext()) {
198 sect
= (Section
)sectionIter
.next();
202 // The last section don't need 4 byte ffsAligment.
204 sect
.toBuffer((DataOutputStream
)dataBuffer
, (DataOutputStream
) orgDataBuffer
);
205 } catch (Exception e
) {
206 throw new BuildException (e
.getMessage());
210 } catch (Exception e
) {
211 throw new BuildException (e
.getMessage());
215 // Creat Ffs file header
220 // create input stream to read file data
222 byte[] fileBuffer
= new byte[(int)ffsFile
.length()];
223 FileInputStream fi
= new FileInputStream (ffsFile
.getAbsolutePath());
224 DataInputStream di
= new DataInputStream (fi
);
229 // create input org stream to read file data
231 byte[] orgFileBuffer
= new byte[(int)ffsOrgFile
.length()];
232 FileInputStream ofi
= new FileInputStream (ffsOrgFile
.getAbsolutePath());
233 DataInputStream odi
= new DataInputStream (ofi
);
234 odi
.read(orgFileBuffer
);
238 // Add GUID to header struct
240 if (this.ffsFileGuid
!= null) {
241 stringToGuid (this.ffsFileGuid
, ffsHeader
.name
);
243 // Add Guid to org header struct
245 stringToGuid (this.ffsFileGuid
, orgFfsHeader
.name
);
248 ffsHeader
.ffsAttributes
= this.attributes
;
249 if ((ffsHeader
.fileType
= stringToType(this.ffsFileType
))== -1) {
250 throw new BuildException ("FFS_FILE_TYPE unknow!\n");
254 // Copy ffsHeader.ffsAttribute and fileType to orgFfsHeader.ffsAttribute
257 orgFfsHeader
.ffsAttributes
= ffsHeader
.ffsAttributes
;
258 orgFfsHeader
.fileType
= ffsHeader
.fileType
;
261 // Adjust file size. The function is used to tripe the last
262 // section padding of 4 binary boundary.
265 if (ffsHeader
.fileType
!= EFI_FV_FILETYPE_RAW
) {
267 fileDataSize
= adjustFileSize (fileBuffer
);
268 orgFileDataSize
= adjustFileSize (orgFileBuffer
);
271 fileDataSize
= fileBuffer
.length
;
272 orgFileDataSize
= orgFileBuffer
.length
;
276 // 1. add header size to file size
278 fileSize
= fileDataSize
+ ffsHeader
.getSize();
280 // add header size to org file size
282 orgFileSize
= orgFileDataSize
+ ffsHeader
.getSize();
284 if ((ffsHeader
.ffsAttributes
& FFS_ATTRIB_TAIL_PRESENT
) != 0) {
285 if (ffsHeader
.fileType
== EFI_FV_FILETYPE_FFS_PAD
) {
287 throw new BuildException (
288 "FFS_ATTRIB_TAIL_PRESENT=TRUE is " +
289 "invalid for PAD files"
292 if (fileSize
== ffsHeader
.getSize()) {
293 throw new BuildException (
294 "FFS_ATTRIB_TAIL_PRESENT=TRUE is " +
295 "invalid for 0-length files"
298 fileSize
= fileSize
+ 2;
299 orgFileSize
= orgFileSize
+ 2;
303 // 2. set file size to header struct
305 ffsHeader
.ffsFileSize
[0] = (byte)(fileSize
& 0x00FF);
306 ffsHeader
.ffsFileSize
[1] = (byte)((fileSize
& 0x00FF00)>>8);
307 ffsHeader
.ffsFileSize
[2] = (byte)(((int)fileSize
& 0xFF0000)>>16);
310 // set file size to org header struct
312 orgFfsHeader
.ffsFileSize
[0] = (byte)(orgFileSize
& 0x00FF);
313 orgFfsHeader
.ffsFileSize
[1] = (byte)((orgFileSize
& 0x00FF00)>>8);
314 orgFfsHeader
.ffsFileSize
[2] = (byte)(((int)orgFileSize
& 0xFF0000)>>16);
317 // Fill in checksums and state, these must be zero for checksumming
319 ffsHeader
.integrityCheck
.header
= calculateChecksum8 (
320 ffsHeader
.structToBuffer(),
324 // Fill in org file's header check sum and state
326 orgFfsHeader
.integrityCheck
.header
= calculateChecksum8 (
327 orgFfsHeader
.structToBuffer(),
328 orgFfsHeader
.getSize()
331 if ((this.attributes
& FFS_ATTRIB_CHECKSUM
) != 0) {
332 if ((this.attributes
& FFS_ATTRIB_TAIL_PRESENT
) != 0) {
333 ffsHeader
.integrityCheck
.file
= calculateChecksum8 (
338 // Add org file header
340 orgFfsHeader
.integrityCheck
.file
= calculateChecksum8 (
345 ffsHeader
.integrityCheck
.file
= calculateChecksum8 (
350 // Add org file header
352 orgFfsHeader
.integrityCheck
.file
= calculateChecksum8 (
358 ffsHeader
.integrityCheck
.file
= FFS_FIXED_CHECKSUM
;
359 orgFfsHeader
.integrityCheck
.file
= FFS_FIXED_CHECKSUM
;
363 // Set the state now. Spec says the checksum assumes the state is 0.
365 ffsHeader
.ffsState
= EFI_FILE_HEADER_CONSTRUCTION
|
366 EFI_FILE_HEADER_VALID
|
368 orgFfsHeader
.integrityCheck
.file
= ffsHeader
.ffsState
;
371 // create output stream to first write header data in file, then write sect data in file.
373 FileOutputStream headerFfs
= new FileOutputStream (ffsFile
.getAbsolutePath());
374 DataOutputStream ffsBuffer
= new DataOutputStream (headerFfs
);
376 FileOutputStream orgHeaderFfs
= new FileOutputStream (ffsOrgFile
.getAbsolutePath());
377 DataOutputStream orgFfsBuffer
= new DataOutputStream (orgHeaderFfs
);
380 // Add header struct and file data to FFS file
382 ffsBuffer
.write(ffsHeader
.structToBuffer());
383 orgFfsBuffer
.write(orgFfsHeader
.structToBuffer());
385 for (int i
= 0; i
< fileDataSize
; i
++) {
386 ffsBuffer
.write(fileBuffer
[i
]);
389 for (int i
= 0; i
< orgFileDataSize
; i
++){
390 orgFfsBuffer
.write(orgFileBuffer
[i
]);
394 // If there is a tail, then set it
396 if ((this.attributes
& FFS_ATTRIB_TAIL_PRESENT
) != 0) {
398 byte [] tailByte
= new byte[2];
401 // reverse tailvalue , integritycheck.file as hight byte, and
402 // integritycheck.header as low byte.
404 tailValue
= (short)(ffsHeader
.integrityCheck
.header
& 0xff);
405 tailValue
= (short)((tailValue
) | ((ffsHeader
.integrityCheck
.file
<< 8) & 0xff00));
406 tailValue
= (short)~tailValue
;
409 // Change short to byte[2]
411 tailByte
[0] = (byte)(tailValue
& 0xff);
412 tailByte
[1] = (byte)((tailValue
& 0xff00)>>8);
413 ffsBuffer
.write(tailByte
[0]);
414 ffsBuffer
.write(tailByte
[1]);
416 orgFfsBuffer
.write(tailByte
[0]);
417 orgFfsBuffer
.write(tailByte
[1]);
421 // close output stream. Note if don't close output stream
422 // the buffer can't be rewritten to file.
425 orgFfsBuffer
.close();
426 System
.out
.print ("Successful create ffs file!\n");
427 } catch (Exception e
) {
428 throw new BuildException (e
.getMessage());
435 This function is to add compress section to section list.
436 @param compress Section of compress
438 public void addCompress(CompressSection compress
) {
439 this.sectionList
.add(compress
);
445 This function is to add tool section to section list.
446 @param tool Section of tool
448 public void addTool(Tool tool
) {
449 this.sectionList
.add(tool
);
455 This function is to add sectFile section to section list.
456 @param sectFile Section of sectFile.
458 public void addSectFile (SectFile sectFile
) {
459 this.sectionList
.add(sectFile
);
465 This function is to get basename
467 @return String of base name
469 public String
getBaseName() {
470 return this.baseName
;
476 This function is to set base name.
479 public void setBaseName(String baseName
) {
480 this.baseName
= baseName
.trim();
486 This function is to get the ffsAligment
487 @return The value of ffsAligment.
489 public int getFfsAligment() {
490 return this.ffsAlignment
;
496 This function is to set ffsAligment
497 @param ffsAligment The value of ffsAligment.
499 public void setFfsAligment(int ffsAligment
) {
500 this.ffsAlignment
= ffsAligment
;
501 if (this.ffsAlignment
> 7) {
502 throw new BuildException ("FFS_ALIGMENT Scope is 0-7");
504 attributes
|= (((byte)this.ffsAlignment
) << 3);
511 This function is to get ffsAttribCheckSum
513 @return Value of ffsAttribChecksum
515 public boolean getFfsAttribChecksum() {
516 return this.FfsAttribChecksum
;
522 This function is to set ffsAttribChecksum
523 @param ffsAttributeCheckSum Value of ffsAttribCheckSum
525 public void setFfsAttribChecksum(boolean ffsAttributeCheckSum
) {
526 this.FfsAttribChecksum
= ffsAttributeCheckSum
;
527 if (ffsAttributeCheckSum
) {
528 attributes
|= FFS_ATTRIB_CHECKSUM
;
535 This function is to get ffsAttribRecovery
536 @return Value of ffsAttribRecovery
538 public boolean getFfsAttribRecovery() {
539 return this.ffsAttribRecovery
;
545 This function is to set ffsAttributeRecovery
547 @param ffsAttributeRecovery Value of ffsAttributeRecovery
549 public void setRecovery(boolean ffsAttributeRecovery
) {
550 this.ffsAttribRecovery
= ffsAttributeRecovery
;
551 if (ffsAttributeRecovery
) {
552 attributes
|= FFS_ATTRIB_RECOVERY
;
559 This function is to get fileGuid
562 public String
getFileGuid() {
563 return this.ffsFileGuid
;
569 This function is to set fileGuid
570 @param ffsFileGuid String of GUID
572 public void setFileGuid(String ffsFileGuid
) {
573 this.ffsFileGuid
= ffsFileGuid
.trim();
579 This function is to get ffsFileType.
581 @return value of ffsFileType
583 public String
getFfsFileType() {
584 return this.ffsFileType
;
590 This function is to set ffsFileType.
594 public void setFfsFileType(String ffsFileType
) {
595 this.ffsFileType
= ffsFileType
.trim();
599 ffsAttribHeaderExtension
601 This function is to get ffsAttribHeaderExtension
603 @return Value of ffsAttribHeaderExtension
605 public boolean isFfsAttribHeaderExtension() {
606 return this.ffsAttribHeaderExtension
;
612 This function is to set headerExtension
613 @param headerExtension Value of headerExension
615 public void setHeaderExtension(boolean headerExtension
) {
616 this.ffsAttribHeaderExtension
= headerExtension
;
617 if (headerExtension
) {
618 attributes
|= FFS_ATTRIB_HEADER_EXTENSION
;
623 isFfsAttribTailPresent
625 This function is to get ffsAttribTailPresent value.
626 @return Value of ffsAttribTailPresent.
628 public boolean isFfsAttribTailPresent() {
629 return this.ffsAttribTailPresent
;
633 setFfsAttribTailPresent
635 This function is to set ffsAttribTailPresent.
636 @param tailPresent Value of ffsAttribTailPresent.
638 public void setFfsAttribTailPresent(boolean tailPresent
) {
639 this.ffsAttribTailPresent
= tailPresent
;
641 attributes
|= FFS_ATTRIB_TAIL_PRESENT
;
649 This function is to convert string to GUID.
650 * @param GuidStr String of GUID.
651 * @param Guid GUID form.
653 private void stringToGuid (String GuidStr
, FfsHeader
.FfsGuid Guid
){
661 byte[] buffer
= new byte[16];
662 if (GuidStr
.length()!=36) {
663 throw new BuildException ("Guid length is not correct!");
667 SplitStr
= GuidStr
.split("-");
668 if (SplitStr
.length
!= 5) {
669 throw new BuildException ("Guid type is not correct!");
674 for (i
= 0; i
< SplitStr
.length
; i
++) {
675 String str
= SplitStr
[i
];
676 charArry
= str
.toCharArray();
678 for (j
=0; j
< (str
.toCharArray().length
)/2; j
++) {
680 buffer
[k
] = hexCharToByte (charArry
[j
*2]);
681 buffer
[k
] = (byte)( buffer
[k
]& 0x0f);
682 buffer
[k
] = (byte)((buffer
[k
]<< 4));
683 buffer
[k
] = (byte)( buffer
[k
]& 0xf0);
684 buffer
[k
] = (byte)( buffer
[k
]|hexCharToByte(charArry
[j
*2+1]));
688 Guid
.bufferToStruct(buffer
);
694 This function is to get suffix of ffs file according to ffsFileType.
696 @param ffsFileType ffsFileType
697 @return The suffix of ffs file
699 private String
TypeToSuffix (String ffsFileType
){
700 if (ffsFileType
.equals("EFI_FV_FILETYPE_ALL")) {
703 if (ffsFileType
.equals("EFI_FV_FILETYPE_RAW")) {
704 return EFI_FV_FFS_FILETYPE_STR
;
706 if (ffsFileType
.equals("EFI_FV_FILETYPE_FREEFORM")) {
707 return EFI_FV_FFS_FILETYPE_STR
;
709 if (ffsFileType
.equals("EFI_FV_FILETYPE_SECURITY_CORE")) {
710 return EFI_FV_SEC_FILETYPE_STR
;
712 if (ffsFileType
.equals("EFI_FV_FILETYPE_PEI_CORE")) {
713 return EFI_FV_PEI_FILETYPE_STR
;
715 if (ffsFileType
.equals("EFI_FV_FILETYPE_DXE_CORE")) {
716 return EFI_FV_DXE_FILETYPE_STR
;
718 if (ffsFileType
.equals("EFI_FV_FILETYPE_PEIM")) {
719 return EFI_FV_PEI_FILETYPE_STR
;
721 if (ffsFileType
.equals("EFI_FV_FILETYPE_DRIVER")) {
722 return EFI_FV_DXE_FILETYPE_STR
;
724 if (ffsFileType
.equals("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER")) {
725 return EFI_FV_PEI_FILETYPE_STR
;
727 if (ffsFileType
.equals("EFI_FV_FILETYPE_APPLICATION")) {
728 return EFI_FV_APP_FILETYPE_STR
;
730 if (ffsFileType
.equals("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE")) {
731 return EFI_FV_FVI_FILETYPE_STR
;
733 if (ffsFileType
.equals("EFI_FV_FILETYPE_FFS_PAD")) {
734 return EFI_FV_FFS_FILETYPE_STR
;
743 This function is to get ffsFileType integer value according to ffsFileType.
744 @param ffsFileType String value of ffsFileType
745 @return Integer value of ffsFileType.
747 private byte stringToType (String ffsFileType
){
749 if (ffsFileType
.equals("EFI_FV_FILETYPE_ALL")) {
750 return(byte)EFI_FV_FILETYPE_ALL
;
753 if (ffsFileType
.equals("EFI_FV_FILETYPE_RAW")) {
754 return(byte)EFI_FV_FILETYPE_RAW
;
757 if (ffsFileType
.equals("EFI_FV_FILETYPE_FREEFORM")) {
758 return(byte)EFI_FV_FILETYPE_FREEFORM
;
761 if (ffsFileType
.equals("EFI_FV_FILETYPE_SECURITY_CORE")) {
762 return(byte)EFI_FV_FILETYPE_SECURITY_CORE
;
765 if (ffsFileType
.equals("EFI_FV_FILETYPE_PEI_CORE")) {
766 return(byte) EFI_FV_FILETYPE_PEI_CORE
;
769 if (ffsFileType
.equals("EFI_FV_FILETYPE_DXE_CORE")) {
770 return(byte)EFI_FV_FILETYPE_DXE_CORE
;
773 if (ffsFileType
.equals("EFI_FV_FILETYPE_PEIM")) {
774 return(byte)EFI_FV_FILETYPE_PEIM
;
777 if (ffsFileType
.equals("EFI_FV_FILETYPE_DRIVER")) {
778 return(byte) EFI_FV_FILETYPE_DRIVER
;
781 if (ffsFileType
.equals("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER")) {
782 return(byte)EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
;
785 if (ffsFileType
.equals("EFI_FV_FILETYPE_APPLICATION")) {
786 return(byte)EFI_FV_FILETYPE_APPLICATION
;
789 if (ffsFileType
.equals("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE")) {
790 return(byte)EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
;
792 if (ffsFileType
.equals("EFI_FV_FILETYPE_FFS_PAD")) {
793 return(byte) EFI_FV_FILETYPE_FFS_PAD
;
804 This function is to calculate the value needed for a valid UINT8 checksum
805 @param buffer Byte buffer containing byte data of component.
806 @param size Size of the buffer.
807 @return The 8 bit checksum value needed.
809 private byte calculateChecksum8 (byte[] buffer
, int size
){
810 return(byte) (0x100 - calculateSum8 (buffer
, size
));
817 This function is to calculate the UINT8 sum for the requested region.
818 @param buffer Byte buffer containing byte data of component
819 @param size Size of the buffer.
820 @return The 8 bit checksum value needed.
822 private short calculateSum8 (byte[] buffer
, int size
){
828 // Perform the word sum for buffer
830 for (Index
= 0; Index
< size
; Index
++) {
831 Sum
= (byte) (Sum
+ buffer
[Index
]);
840 This function is to convert hex character to byte
842 @param hexChar hex character
843 @return Byte which corresponding to the character.
845 private byte hexCharToByte (char hexChar
){
896 This function is used to adjusts file size to insure sectioned file is exactly the right length such
897 that it ends on exactly the last byte of the last section. ProcessScript()
898 may have padded beyond the end of the last section out to a 4 byte boundary.
899 This padding is stripped.
901 @param buffer Byte buffer contains a section stream
902 @return Corrected size of file.
904 private int adjustFileSize (byte[] buffer
){
906 int orignalLen
= buffer
.length
;
908 int sectionPoint
= 0;
909 int nextSectionPoint
= 0;
912 int firstSectionHeader
= 0;
915 firstSectionHeader
= buffer
[0]& 0xff;
916 firstSectionHeader
= ((buffer
[1]&0xff)<<8) | firstSectionHeader
;
917 firstSectionHeader
= ((buffer
[2]&0xff)<<16)| firstSectionHeader
;
920 while (sectionPoint
< buffer
.length
) {
921 sectionLen
= buffer
[0 + sectionPoint
]& 0xff;
922 sectionLen
= ((buffer
[1 + sectionPoint
]&0xff)<<8)| sectionLen
;
923 sectionLen
= ((buffer
[2 + sectionPoint
]&0xff)<<16)| sectionLen
;
924 totalLen
= totalLen
+ sectionLen
;
926 if (totalLen
== orignalLen
) {
930 sectionPoint
= sectionPoint
+ sectionLen
;
931 adjustLen
= sectionPoint
;
933 nextSectionPoint
= (sectionPoint
+ 0x03) & (~
0x03);
934 totalLen
= totalLen
+ nextSectionPoint
- sectionLen
;
935 sectionPoint
= nextSectionPoint
;
943 This function is to get output directory.
945 @return Path of output directory.
947 public String
getOutputDir() {
954 This function is to set output directory.
956 @param outputDir The output direcotry.
958 public void setOutputDir(String outputDir
) {
959 this.outputDir
= outputDir
;