4 This class is to generate the compressed section header.
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.
17 package org
.tianocore
.framework
.tasks
;
19 import org
.apache
.tools
.ant
.BuildException
;
22 Internal class: This class is to generate the compressed section header.
25 public class CompressHeader
{
30 This class define the compressed header structor.
33 public class CommonSectionHeader
{
34 byte[] Size
= new byte[3];
41 public CommonSectionHeader SectionHeader
= new CommonSectionHeader();
44 /// Length of uncompress section in byte.
46 public int UncompressLen
;
50 public byte CompressType
;
53 /// The size of compress header in byte.
55 public int GetSize (){
60 /// Write class member to buffer.
62 public void StructToBuffer (byte[] Buffer
){
63 if (Buffer
.length
!= GetSize()) {
64 throw new BuildException ("CompressHeader Buffer size is not correct!");
66 for (int i
= 0; i
< 3; i
++){
67 Buffer
[i
] = SectionHeader
.Size
[i
];
69 Buffer
[3] = SectionHeader
.type
;
70 Buffer
[4] = (byte)(UncompressLen
& 0xff);
71 Buffer
[5] = (byte)((UncompressLen
& 0xff00)>>8);
72 Buffer
[6] = (byte)((UncompressLen
& 0xff0000)>>16);
73 Buffer
[7] = (byte)((UncompressLen
& 0xff000000)>>24);
74 Buffer
[8] = CompressType
;