Search in sources :

Example 1 with LittleEndianOutput

use of org.apache.poi.util.LittleEndianOutput in project poi by apache.

the class StandardEncryptionHeader method write.

/**
     * serializes the header 
     */
@Override
public void write(LittleEndianByteArrayOutputStream bos) {
    int startIdx = bos.getWriteIndex();
    LittleEndianOutput sizeOutput = bos.createDelayedOutput(LittleEndianConsts.INT_SIZE);
    bos.writeInt(getFlags());
    // size extra
    bos.writeInt(0);
    bos.writeInt(getCipherAlgorithm().ecmaId);
    bos.writeInt(getHashAlgorithm().ecmaId);
    bos.writeInt(getKeySize());
    bos.writeInt(getCipherProvider().ecmaId);
    // reserved1
    bos.writeInt(0);
    // reserved2
    bos.writeInt(0);
    String cspName = getCspName();
    if (cspName == null) {
        cspName = getCipherProvider().cipherProviderName;
    }
    bos.write(StringUtil.getToUnicodeLE(cspName));
    bos.writeShort(0);
    int headerSize = bos.getWriteIndex() - startIdx - LittleEndianConsts.INT_SIZE;
    sizeOutput.writeInt(headerSize);
}
Also used : LittleEndianOutput(org.apache.poi.util.LittleEndianOutput)

Example 2 with LittleEndianOutput

use of org.apache.poi.util.LittleEndianOutput in project poi by apache.

the class ContinuableRecord method serialize.

public final int serialize(int offset, byte[] data) {
    LittleEndianOutput leo = new LittleEndianByteArrayOutputStream(data, offset);
    ContinuableRecordOutput out = new ContinuableRecordOutput(leo, getSid());
    serialize(out);
    out.terminate();
    return out.getTotalSize();
}
Also used : LittleEndianOutput(org.apache.poi.util.LittleEndianOutput) LittleEndianByteArrayOutputStream(org.apache.poi.util.LittleEndianByteArrayOutputStream)

Aggregations

LittleEndianOutput (org.apache.poi.util.LittleEndianOutput)2 LittleEndianByteArrayOutputStream (org.apache.poi.util.LittleEndianByteArrayOutputStream)1