ResImageTiles.java 3.39 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.scene7.is.ipp.messages;

import com.scene7.is.ipp.messages.InMessage;
import com.scene7.is.ipp.messages.Ipp;
import com.scene7.is.ipp.messages.IppTile;
import com.scene7.is.ipp.messages.IppTileAddrReduced;
import com.scene7.is.ipp.messages.Offset;
import java.io.IOException;
import java.io.Writer;

public class ResImageTiles
extends InMessage {
    static int MessageNumber = 131842;
    private IppTile[] tiles_;
    private IppTileAddrReduced[] reduced_;

    public ResImageTiles(int tag, IppTile[] tiles, IppTileAddrReduced[] reduced, int headClientId) {
        this.tag_ = tag;
        this.headerClientId_ = headClientId;
        this.tiles_ = tiles;
        this.reduced_ = reduced;
        int fixedLength = 24;
        Offset varPos = new Offset(fixedLength);
        if (tiles != null) {
            varPos.val = varPos.val + 7 & -8;
            varPos.val += tiles.length * 56;
            for (int i = 0; i < tiles.length; ++i) {
                tiles[i].adjustVarPos(varPos);
            }
        }
        if (reduced != null) {
            varPos.val = varPos.val + 7 & -8;
            varPos.val += reduced.length * 24;
        }
        this.messageLength_ = varPos.val;
        varPos.val = fixedLength;
        Offset pos = new Offset(0);
        this.headBuffer_ = new byte[32];
        this.bodyBuffer_ = new byte[this.messageLength_];
        Ipp.StuffHeader(this.headBuffer_, this.headerClientId_, tag, MessageNumber, this.messageLength_);
        IppTile.StuffArray(this.bodyBuffer_, pos, varPos, this.tiles_);
        IppTileAddrReduced.StuffArray(this.bodyBuffer_, pos, varPos, this.reduced_);
        Ipp.Assert(pos.val == fixedLength, "IppWatermarkType length");
    }

    public ResImageTiles() {
    }

    public void process(int headClientId, int tg, byte[] bf) {
        this.headerClientId_ = headClientId;
        this.tag_ = tg;
        this.messageLength_ = bf.length;
        this.headBuffer_ = new byte[32];
        Ipp.StuffHeader(this.headBuffer_, this.headerClientId_, this.tag_, MessageNumber, this.messageLength_);
        this.bodyBuffer_ = bf;
        Offset pos = new Offset(0);
        this.tiles_ = IppTile.UnstuffArray(this.bodyBuffer_, pos);
        this.reduced_ = IppTileAddrReduced.UnstuffArray(this.bodyBuffer_, pos);
    }

    public int classification() {
        return 1;
    }

    public int id() {
        return MessageNumber;
    }

    public void print(Writer tf, String heading) throws IOException {
        tf.write("\n");
        tf.write(heading);
        tf.write(": ResImageTiles ");
        Ipp.PrintHex(tf, MessageNumber);
        tf.write("\n");
        tf.write("headClientId: " + this.headerClientId() + "\n");
        Ipp.PrintTag(tf, "tag: ", this.tag());
        tf.write("length: " + this.length());
        tf.write("\n");
        IppTile.PrintArray(tf, "tiles: ", this.tiles_);
        IppTileAddrReduced.PrintArray(tf, "reduced: ", this.reduced_);
    }

    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("ResImageTiles                 ");
        buffer.append("[tiles: " + String.valueOf(this.tiles_) + "],");
        buffer.append("[reduced: " + String.valueOf(this.reduced_) + "],");
        return buffer.toString();
    }

    public IppTile[] tiles() {
        return this.tiles_;
    }

    public IppTileAddrReduced[] reduced() {
        return this.reduced_;
    }
}