package jxl.write.biff;

import com.seewo.sdk.model.SDKKeyboardCode;
import common.Assert;
import common.Logger;
import d.b.a.a.a;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import jxl.biff.BaseCompoundFile;
import jxl.biff.IntegerHelper;
import jxl.read.biff.BiffException;

/* JADX INFO: loaded from: classes.dex */
public final class CompoundFile extends BaseCompoundFile {
    public static /* synthetic */ Class class$jxl$write$biff$CompoundFile;
    private static Logger logger;
    private int additionalPropertyBlocks;
    private ArrayList additionalPropertySets;
    private int bbdPos;
    private int bbdStartBlock;
    private byte[] bigBlockDepot;
    private byte[] excelData;
    private int excelDataBlocks;
    private int excelDataStartBlock;
    private int extensionBlock;
    private int numBigBlockDepotBlocks;
    private int numExtensionBlocks;
    private int numPropertySets;
    private int numRootEntryBlocks;
    private int numSmallBlockDepotBlocks;
    private int numSmallBlockDepotChainBlocks;
    private int numSmallBlocks;
    private OutputStream out;
    private int requiredSize;
    private int rootStartBlock;
    private int sbdStartBlock;
    private int sbdStartBlockChain;
    private int size;
    private HashMap standardPropertySets;

    public static final class ReadPropertyStorage {
        public byte[] data;
        public int number;
        public BaseCompoundFile.PropertyStorage propertyStorage;

        public ReadPropertyStorage(BaseCompoundFile.PropertyStorage propertyStorage, byte[] bArr, int i2) {
            this.propertyStorage = propertyStorage;
            this.data = bArr;
            this.number = i2;
        }
    }

    static {
        Class clsClass$ = class$jxl$write$biff$CompoundFile;
        if (clsClass$ == null) {
            clsClass$ = class$("jxl.write.biff.CompoundFile");
            class$jxl$write$biff$CompoundFile = clsClass$;
        }
        logger = Logger.getLogger(clsClass$);
    }

    public CompoundFile(byte[] bArr, int i2, OutputStream outputStream, jxl.read.biff.CompoundFile compoundFile) throws IOException, CopyAdditionalPropertySetsException {
        this.size = i2;
        this.excelData = bArr;
        readAdditionalPropertySets(compoundFile);
        this.numRootEntryBlocks = 1;
        ArrayList arrayList = this.additionalPropertySets;
        this.numPropertySets = (arrayList != null ? arrayList.size() : 0) + 4;
        if (this.additionalPropertySets != null) {
            this.numSmallBlockDepotChainBlocks = getBigBlocksRequired(this.numSmallBlocks * 4);
            this.numSmallBlockDepotBlocks = getBigBlocksRequired(this.numSmallBlocks * 64);
            this.numRootEntryBlocks += getBigBlocksRequired(this.additionalPropertySets.size() * 128);
        }
        int bigBlocksRequired = getBigBlocksRequired(i2);
        if (i2 < 4096) {
            this.requiredSize = 4096;
        } else {
            this.requiredSize = bigBlocksRequired * 512;
        }
        this.out = outputStream;
        int i3 = this.requiredSize / 512;
        this.excelDataBlocks = i3;
        this.numBigBlockDepotBlocks = 1;
        int i4 = i3 + 8 + 8 + this.additionalPropertyBlocks + this.numSmallBlockDepotBlocks + this.numSmallBlockDepotChainBlocks + this.numRootEntryBlocks;
        int iCeil = (int) Math.ceil(((double) (i4 + 1)) / 128.0d);
        this.numBigBlockDepotBlocks = iCeil;
        int iCeil2 = (int) Math.ceil(((double) (iCeil + i4)) / 128.0d);
        this.numBigBlockDepotBlocks = iCeil2;
        int i5 = i4 + iCeil2;
        if (iCeil2 > 108) {
            this.extensionBlock = 0;
            int iCeil3 = (int) Math.ceil(((double) ((iCeil2 - 109) + 1)) / 127.0d);
            this.numExtensionBlocks = iCeil3;
            int iCeil4 = (int) Math.ceil(((double) ((iCeil3 + i4) + this.numBigBlockDepotBlocks)) / 128.0d);
            this.numBigBlockDepotBlocks = iCeil4;
            i5 = i4 + this.numExtensionBlocks + iCeil4;
        } else {
            this.extensionBlock = -2;
            this.numExtensionBlocks = 0;
        }
        int i6 = this.numExtensionBlocks;
        this.excelDataStartBlock = i6;
        this.sbdStartBlock = -2;
        if (this.additionalPropertySets != null && this.numSmallBlockDepotBlocks != 0) {
            this.sbdStartBlock = this.excelDataBlocks + i6 + this.additionalPropertyBlocks + 16;
        }
        this.sbdStartBlockChain = -2;
        int i7 = this.sbdStartBlock;
        if (i7 != -2) {
            this.sbdStartBlockChain = i7 + this.numSmallBlockDepotBlocks;
        }
        int i8 = this.sbdStartBlockChain;
        if (i8 != -2) {
            this.bbdStartBlock = i8 + this.numSmallBlockDepotChainBlocks;
        } else {
            this.bbdStartBlock = i6 + this.excelDataBlocks + this.additionalPropertyBlocks + 16;
        }
        int i9 = this.bbdStartBlock + this.numBigBlockDepotBlocks;
        this.rootStartBlock = i9;
        if (i5 != i9 + this.numRootEntryBlocks) {
            logger.warn("Root start block and total blocks are inconsistent  generated file may be corrupt");
            Logger logger2 = logger;
            StringBuffer stringBufferZ = a.z("RootStartBlock ");
            stringBufferZ.append(this.rootStartBlock);
            stringBufferZ.append(" totalBlocks ");
            stringBufferZ.append(i5);
            logger2.warn(stringBufferZ.toString());
        }
    }

    private void checkBbdPos() throws IOException {
        if (this.bbdPos >= 512) {
            this.out.write(this.bigBlockDepot);
            this.bigBlockDepot = new byte[512];
            this.bbdPos = 0;
        }
    }

    public static /* synthetic */ Class class$(String str) {
        try {
            return Class.forName(str);
        } catch (ClassNotFoundException e2) {
            throw new NoClassDefFoundError(e2.getMessage());
        }
    }

    private int getBigBlocksRequired(int i2) {
        int i3 = i2 / 512;
        return i2 % 512 > 0 ? i3 + 1 : i3;
    }

    private int getSmallBlocksRequired(int i2) {
        int i3 = i2 / 64;
        return i2 % 64 > 0 ? i3 + 1 : i3;
    }

    private void readAdditionalPropertySets(jxl.read.biff.CompoundFile compoundFile) throws IOException, CopyAdditionalPropertySetsException {
        boolean z;
        if (compoundFile == null) {
            return;
        }
        this.additionalPropertySets = new ArrayList();
        this.standardPropertySets = new HashMap();
        int numberOfPropertySets = compoundFile.getNumberOfPropertySets();
        int bigBlocksRequired = 0;
        for (int i2 = 0; i2 < numberOfPropertySets; i2++) {
            BaseCompoundFile.PropertyStorage propertySet = compoundFile.getPropertySet(i2);
            if (propertySet.name.equalsIgnoreCase(BaseCompoundFile.ROOT_ENTRY_NAME)) {
                this.standardPropertySets.put(BaseCompoundFile.ROOT_ENTRY_NAME, new ReadPropertyStorage(propertySet, null, i2));
                z = true;
            } else {
                z = false;
            }
            int i3 = 0;
            while (true) {
                String[] strArr = BaseCompoundFile.STANDARD_PROPERTY_SETS;
                if (i3 >= strArr.length || z) {
                    break;
                }
                if (propertySet.name.equalsIgnoreCase(strArr[i3])) {
                    BaseCompoundFile.PropertyStorage propertyStorageFindPropertyStorage = compoundFile.findPropertyStorage(propertySet.name);
                    Assert.verify(propertyStorageFindPropertyStorage != null);
                    if (propertyStorageFindPropertyStorage == propertySet) {
                        this.standardPropertySets.put(strArr[i3], new ReadPropertyStorage(propertySet, null, i2));
                        z = true;
                    }
                }
                i3++;
            }
            if (!z) {
                try {
                    byte[] stream = propertySet.size > 0 ? compoundFile.getStream(i2) : new byte[0];
                    this.additionalPropertySets.add(new ReadPropertyStorage(propertySet, stream, i2));
                    if (stream.length > 4096) {
                        bigBlocksRequired += getBigBlocksRequired(stream.length);
                    } else {
                        this.numSmallBlocks += getSmallBlocksRequired(stream.length);
                    }
                } catch (BiffException e2) {
                    logger.error(e2);
                    throw new CopyAdditionalPropertySetsException();
                }
            }
        }
        this.additionalPropertyBlocks = bigBlocksRequired;
    }

    private void writeAdditionalPropertySetBlockChains() throws IOException {
        ArrayList arrayList = this.additionalPropertySets;
        if (arrayList == null) {
            return;
        }
        int i2 = this.excelDataStartBlock + this.excelDataBlocks + 16;
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            byte[] bArr = ((ReadPropertyStorage) it.next()).data;
            if (bArr.length > 4096) {
                int bigBlocksRequired = getBigBlocksRequired(bArr.length);
                writeBlockChain(i2, bigBlocksRequired);
                i2 += bigBlocksRequired;
            }
        }
    }

    private void writeAdditionalPropertySets() throws IOException {
        ArrayList arrayList = this.additionalPropertySets;
        if (arrayList == null) {
            return;
        }
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            byte[] bArr = ((ReadPropertyStorage) it.next()).data;
            if (bArr.length > 4096) {
                int bigBlocksRequired = getBigBlocksRequired(bArr.length) * 512;
                this.out.write(bArr, 0, bArr.length);
                int length = bigBlocksRequired - bArr.length;
                this.out.write(new byte[length], 0, length);
            }
        }
    }

    private void writeBigBlockDepot() throws IOException {
        this.bigBlockDepot = new byte[512];
        this.bbdPos = 0;
        for (int i2 = 0; i2 < this.numExtensionBlocks; i2++) {
            IntegerHelper.getFourBytes(-3, this.bigBlockDepot, this.bbdPos);
            this.bbdPos += 4;
            checkBbdPos();
        }
        writeBlockChain(this.excelDataStartBlock, this.excelDataBlocks);
        int i3 = this.excelDataStartBlock + this.excelDataBlocks + this.additionalPropertyBlocks;
        int i4 = i3;
        while (i4 < i3 + 7) {
            i4++;
            IntegerHelper.getFourBytes(i4, this.bigBlockDepot, this.bbdPos);
            this.bbdPos += 4;
            checkBbdPos();
        }
        IntegerHelper.getFourBytes(-2, this.bigBlockDepot, this.bbdPos);
        this.bbdPos += 4;
        checkBbdPos();
        int i5 = i3 + 8;
        while (i5 < i3 + 15) {
            i5++;
            IntegerHelper.getFourBytes(i5, this.bigBlockDepot, this.bbdPos);
            this.bbdPos += 4;
            checkBbdPos();
        }
        IntegerHelper.getFourBytes(-2, this.bigBlockDepot, this.bbdPos);
        this.bbdPos += 4;
        checkBbdPos();
        writeAdditionalPropertySetBlockChains();
        int i6 = this.sbdStartBlock;
        if (i6 != -2) {
            writeBlockChain(i6, this.numSmallBlockDepotBlocks);
            writeBlockChain(this.sbdStartBlockChain, this.numSmallBlockDepotChainBlocks);
        }
        for (int i7 = 0; i7 < this.numBigBlockDepotBlocks; i7++) {
            IntegerHelper.getFourBytes(-3, this.bigBlockDepot, this.bbdPos);
            this.bbdPos += 4;
            checkBbdPos();
        }
        writeBlockChain(this.rootStartBlock, this.numRootEntryBlocks);
        int i8 = this.bbdPos;
        if (i8 != 0) {
            while (i8 < 512) {
                this.bigBlockDepot[i8] = -1;
                i8++;
            }
            this.out.write(this.bigBlockDepot);
        }
    }

    private void writeBlockChain(int i2, int i3) throws IOException {
        int i4 = i3 - 1;
        int i5 = i2 + 1;
        while (i4 > 0) {
            int iMin = Math.min(i4, (512 - this.bbdPos) / 4);
            for (int i6 = 0; i6 < iMin; i6++) {
                IntegerHelper.getFourBytes(i5, this.bigBlockDepot, this.bbdPos);
                this.bbdPos += 4;
                i5++;
            }
            i4 -= iMin;
            checkBbdPos();
        }
        IntegerHelper.getFourBytes(-2, this.bigBlockDepot, this.bbdPos);
        this.bbdPos += 4;
        checkBbdPos();
    }

    private void writeDocumentSummaryData() throws IOException {
        this.out.write(new byte[4096]);
    }

    private void writeExcelData() throws IOException {
        this.out.write(this.excelData, 0, this.size);
        this.out.write(new byte[this.requiredSize - this.size]);
    }

    private void writeHeader() throws IOException {
        int i2;
        byte[] bArr = new byte[512];
        int i3 = this.numExtensionBlocks * 512;
        byte[] bArr2 = new byte[i3];
        byte[] bArr3 = BaseCompoundFile.IDENTIFIER;
        System.arraycopy(bArr3, 0, bArr, 0, bArr3.length);
        bArr[24] = SDKKeyboardCode.FUNCTION_KEY_BOARD_F5;
        bArr[26] = 3;
        bArr[28] = -2;
        bArr[29] = -1;
        bArr[30] = 9;
        bArr[32] = 6;
        bArr[57] = SDKKeyboardCode.FUNCTION_KEY_BOARD_M;
        IntegerHelper.getFourBytes(this.numBigBlockDepotBlocks, bArr, 44);
        IntegerHelper.getFourBytes(this.sbdStartBlockChain, bArr, 60);
        IntegerHelper.getFourBytes(this.numSmallBlockDepotChainBlocks, bArr, 64);
        IntegerHelper.getFourBytes(this.extensionBlock, bArr, 68);
        IntegerHelper.getFourBytes(this.numExtensionBlocks, bArr, 72);
        IntegerHelper.getFourBytes(this.rootStartBlock, bArr, 48);
        int iMin = Math.min(this.numBigBlockDepotBlocks, 109);
        int i4 = 76;
        int i5 = 0;
        for (int i6 = 0; i6 < iMin; i6++) {
            IntegerHelper.getFourBytes(this.bbdStartBlock + i6, bArr, i4);
            i4 += 4;
            i5++;
        }
        while (i4 < 512) {
            bArr[i4] = -1;
            i4++;
        }
        this.out.write(bArr);
        int i7 = 0;
        int i8 = 0;
        while (true) {
            i2 = this.numExtensionBlocks;
            if (i7 >= i2) {
                break;
            }
            int iMin2 = Math.min(this.numBigBlockDepotBlocks - i5, 127);
            for (int i9 = 0; i9 < iMin2; i9++) {
                IntegerHelper.getFourBytes(this.bbdStartBlock + i5 + i9, bArr2, i8);
                i8 += 4;
            }
            i5 += iMin2;
            IntegerHelper.getFourBytes(i5 == this.numBigBlockDepotBlocks ? -2 : i7 + 1, bArr2, i8);
            i8 += 4;
            i7++;
        }
        if (i2 > 0) {
            while (i8 < i3) {
                bArr2[i8] = -1;
                i8++;
            }
            this.out.write(bArr2);
        }
    }

    private void writePropertySets() throws IOException {
        int[] iArr;
        int bigBlocksRequired;
        int i2;
        int i3;
        ReadPropertyStorage readPropertyStorage;
        String[] strArr;
        int i4 = 512;
        byte[] bArr = new byte[this.numRootEntryBlocks * 512];
        int i5 = 1;
        if (this.additionalPropertySets != null) {
            iArr = new int[this.numPropertySets];
            int i6 = 0;
            while (true) {
                strArr = BaseCompoundFile.STANDARD_PROPERTY_SETS;
                if (i6 >= strArr.length) {
                    break;
                }
                ReadPropertyStorage readPropertyStorage2 = (ReadPropertyStorage) this.standardPropertySets.get(strArr[i6]);
                if (readPropertyStorage2 != null) {
                    iArr[readPropertyStorage2.number] = i6;
                } else {
                    Logger logger2 = logger;
                    StringBuffer stringBufferZ = a.z("Standard property set ");
                    stringBufferZ.append(strArr[i6]);
                    stringBufferZ.append(" not present in source file");
                    logger2.warn(stringBufferZ.toString());
                }
                i6++;
            }
            int length = strArr.length;
            Iterator it = this.additionalPropertySets.iterator();
            while (it.hasNext()) {
                iArr[((ReadPropertyStorage) it.next()).number] = length;
                length++;
            }
        } else {
            iArr = null;
        }
        if (this.additionalPropertySets != null) {
            bigBlocksRequired = (getBigBlocksRequired(4096) * 512) + (getBigBlocksRequired(4096) * 512) + (getBigBlocksRequired(this.requiredSize) * 512) + 0;
            Iterator it2 = this.additionalPropertySets.iterator();
            while (it2.hasNext()) {
                BaseCompoundFile.PropertyStorage propertyStorage = ((ReadPropertyStorage) it2.next()).propertyStorage;
                if (propertyStorage.type != 1) {
                    int i7 = propertyStorage.size;
                    bigBlocksRequired += i7 >= 4096 ? getBigBlocksRequired(i7) * 512 : getSmallBlocksRequired(i7) * 64;
                }
            }
        } else {
            bigBlocksRequired = 0;
        }
        BaseCompoundFile.PropertyStorage propertyStorage2 = new BaseCompoundFile.PropertyStorage(BaseCompoundFile.ROOT_ENTRY_NAME);
        propertyStorage2.setType(5);
        propertyStorage2.setStartBlock(this.sbdStartBlock);
        propertyStorage2.setSize(bigBlocksRequired);
        propertyStorage2.setPrevious(-1);
        propertyStorage2.setNext(-1);
        propertyStorage2.setColour(0);
        propertyStorage2.setChild(this.additionalPropertySets != null ? iArr[((ReadPropertyStorage) this.standardPropertySets.get(BaseCompoundFile.ROOT_ENTRY_NAME)).propertyStorage.child] : 1);
        System.arraycopy(propertyStorage2.data, 0, bArr, 0, 128);
        BaseCompoundFile.PropertyStorage propertyStorage3 = new BaseCompoundFile.PropertyStorage(BaseCompoundFile.WORKBOOK_NAME);
        propertyStorage3.setType(2);
        propertyStorage3.setStartBlock(this.excelDataStartBlock);
        propertyStorage3.setSize(this.requiredSize);
        int i8 = 3;
        if (this.additionalPropertySets != null) {
            BaseCompoundFile.PropertyStorage propertyStorage4 = ((ReadPropertyStorage) this.standardPropertySets.get(BaseCompoundFile.WORKBOOK_NAME)).propertyStorage;
            int i9 = propertyStorage4.previous;
            i3 = i9 != -1 ? iArr[i9] : -1;
            int i10 = propertyStorage4.next;
            i2 = i10 != -1 ? iArr[i10] : -1;
        } else {
            i2 = -1;
            i3 = 3;
        }
        propertyStorage3.setPrevious(i3);
        propertyStorage3.setNext(i2);
        propertyStorage3.setChild(-1);
        System.arraycopy(propertyStorage3.data, 0, bArr, 128, 128);
        BaseCompoundFile.PropertyStorage propertyStorage5 = new BaseCompoundFile.PropertyStorage(BaseCompoundFile.SUMMARY_INFORMATION_NAME);
        propertyStorage5.setType(2);
        propertyStorage5.setStartBlock(this.excelDataStartBlock + this.excelDataBlocks);
        propertyStorage5.setSize(4096);
        if (this.additionalPropertySets != null && (readPropertyStorage = (ReadPropertyStorage) this.standardPropertySets.get(BaseCompoundFile.SUMMARY_INFORMATION_NAME)) != null) {
            BaseCompoundFile.PropertyStorage propertyStorage6 = readPropertyStorage.propertyStorage;
            int i11 = propertyStorage6.previous;
            int i12 = i11 != -1 ? iArr[i11] : -1;
            int i13 = propertyStorage6.next;
            i8 = i13 != -1 ? iArr[i13] : -1;
            i5 = i12;
        }
        propertyStorage5.setPrevious(i5);
        propertyStorage5.setNext(i8);
        propertyStorage5.setChild(-1);
        System.arraycopy(propertyStorage5.data, 0, bArr, 256, 128);
        BaseCompoundFile.PropertyStorage propertyStorage7 = new BaseCompoundFile.PropertyStorage(BaseCompoundFile.DOCUMENT_SUMMARY_INFORMATION_NAME);
        propertyStorage7.setType(2);
        propertyStorage7.setStartBlock(this.excelDataStartBlock + this.excelDataBlocks + 8);
        propertyStorage7.setSize(4096);
        propertyStorage7.setPrevious(-1);
        propertyStorage7.setNext(-1);
        propertyStorage7.setChild(-1);
        System.arraycopy(propertyStorage7.data, 0, bArr, 384, 128);
        ArrayList<ReadPropertyStorage> arrayList = this.additionalPropertySets;
        if (arrayList == null) {
            this.out.write(bArr);
            return;
        }
        int bigBlocksRequired2 = this.excelDataStartBlock + this.excelDataBlocks + 16;
        int smallBlocksRequired = 0;
        for (ReadPropertyStorage readPropertyStorage3 : arrayList) {
            int i14 = readPropertyStorage3.data.length > 4096 ? bigBlocksRequired2 : smallBlocksRequired;
            BaseCompoundFile.PropertyStorage propertyStorage8 = new BaseCompoundFile.PropertyStorage(readPropertyStorage3.propertyStorage.name);
            propertyStorage8.setType(readPropertyStorage3.propertyStorage.type);
            propertyStorage8.setStartBlock(i14);
            propertyStorage8.setSize(readPropertyStorage3.propertyStorage.size);
            BaseCompoundFile.PropertyStorage propertyStorage9 = readPropertyStorage3.propertyStorage;
            int i15 = propertyStorage9.previous;
            int i16 = i15 != -1 ? iArr[i15] : -1;
            int i17 = propertyStorage9.next;
            int i18 = i17 != -1 ? iArr[i17] : -1;
            int i19 = propertyStorage9.child;
            int i20 = i19 != -1 ? iArr[i19] : -1;
            propertyStorage8.setPrevious(i16);
            propertyStorage8.setNext(i18);
            propertyStorage8.setChild(i20);
            System.arraycopy(propertyStorage8.data, 0, bArr, i4, 128);
            i4 += 128;
            byte[] bArr2 = readPropertyStorage3.data;
            if (bArr2.length > 4096) {
                bigBlocksRequired2 += getBigBlocksRequired(bArr2.length);
            } else {
                smallBlocksRequired += getSmallBlocksRequired(bArr2.length);
            }
        }
        this.out.write(bArr);
    }

    private void writeSmallBlockDepot() throws IOException {
        ArrayList<ReadPropertyStorage> arrayList = this.additionalPropertySets;
        if (arrayList == null) {
            return;
        }
        byte[] bArr = new byte[this.numSmallBlockDepotBlocks * 512];
        int i2 = 0;
        for (ReadPropertyStorage readPropertyStorage : arrayList) {
            byte[] bArr2 = readPropertyStorage.data;
            if (bArr2.length <= 4096) {
                int smallBlocksRequired = getSmallBlocksRequired(bArr2.length) * 64;
                byte[] bArr3 = readPropertyStorage.data;
                System.arraycopy(bArr3, 0, bArr, i2, bArr3.length);
                i2 += smallBlocksRequired;
            }
        }
        this.out.write(bArr);
    }

    private void writeSmallBlockDepotChain() throws IOException {
        if (this.sbdStartBlockChain == -2) {
            return;
        }
        byte[] bArr = new byte[this.numSmallBlockDepotChainBlocks * 512];
        Iterator it = this.additionalPropertySets.iterator();
        int i2 = 0;
        int i3 = 1;
        while (it.hasNext()) {
            byte[] bArr2 = ((ReadPropertyStorage) it.next()).data;
            if (bArr2.length <= 4096 && bArr2.length != 0) {
                int smallBlocksRequired = getSmallBlocksRequired(bArr2.length);
                for (int i4 = 0; i4 < smallBlocksRequired - 1; i4++) {
                    IntegerHelper.getFourBytes(i3, bArr, i2);
                    i2 += 4;
                    i3++;
                }
                IntegerHelper.getFourBytes(-2, bArr, i2);
                i2 += 4;
                i3++;
            }
        }
        this.out.write(bArr);
    }

    private void writeSummaryData() throws IOException {
        this.out.write(new byte[4096]);
    }

    public void write() throws IOException {
        writeHeader();
        writeExcelData();
        writeDocumentSummaryData();
        writeSummaryData();
        writeAdditionalPropertySets();
        writeSmallBlockDepot();
        writeSmallBlockDepotChain();
        writeBigBlockDepot();
        writePropertySets();
    }
}
