ResDev1.java 5.86 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.IppByteArray;
import com.scene7.is.ipp.messages.IppDouble;
import com.scene7.is.ipp.messages.IppInt;
import com.scene7.is.ipp.messages.IppInt64;
import com.scene7.is.ipp.messages.IppProp;
import com.scene7.is.ipp.messages.IppString;
import com.scene7.is.ipp.messages.Offset;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.Writer;

public class ResDev1
extends InMessage {
    static int MessageNumber = 2163463;
    private int[] ints_;
    private long[] int64s_;
    private double[] doubles_;
    private String[] strings_;
    private IppProp[] props_;
    private byte[] bytes_;

    public ResDev1(int tag, int[] ints, long[] int64s, double[] doubles, String[] strings, IppProp[] props, byte[] bytes, int headClientId) {
        int i;
        this.tag_ = tag;
        this.headerClientId_ = headClientId;
        this.ints_ = ints;
        this.int64s_ = int64s;
        this.doubles_ = doubles;
        this.strings_ = strings;
        this.props_ = props;
        this.bytes_ = bytes;
        int fixedLength = 68;
        Offset varPos = new Offset(fixedLength);
        if (ints != null) {
            varPos.val = varPos.val + 3 & -4;
            varPos.val += ints.length * 4;
        }
        if (int64s != null) {
            varPos.val = varPos.val + 7 & -8;
            varPos.val += int64s.length * 8;
        }
        if (doubles != null) {
            varPos.val = varPos.val + 7 & -8;
            varPos.val += doubles.length * 8;
        }
        if (strings != null) {
            varPos.val = varPos.val + 3 & -4;
            varPos.val += strings.length * 4;
            for (i = 0; i < strings.length; ++i) {
                try {
                    varPos.val += strings[i].getBytes("UTF-8").length + 1;
                    continue;
                }
                catch (UnsupportedEncodingException e) {
                    throw new AssertionError(e);
                }
            }
        }
        if (props != null) {
            varPos.val = varPos.val + 7 & -8;
            varPos.val += props.length * 48;
            for (i = 0; i < props.length; ++i) {
                props[i].adjustVarPos(varPos);
            }
        }
        varPos.val += bytes.length;
        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_);
        IppInt.StuffArray(this.bodyBuffer_, pos, varPos, this.ints_);
        IppInt64.StuffArray(this.bodyBuffer_, pos, varPos, this.int64s_);
        IppDouble.StuffArray(this.bodyBuffer_, pos, varPos, this.doubles_);
        IppString.StuffArray(this.bodyBuffer_, pos, varPos, this.strings_);
        IppProp.StuffArray(this.bodyBuffer_, pos, varPos, this.props_);
        IppByteArray.Stuff(this.bodyBuffer_, pos, varPos, this.bytes_);
        Ipp.Assert(pos.val == fixedLength, "IppWatermarkType length");
    }

    public ResDev1() {
    }

    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.ints_ = IppInt.UnstuffArray(this.bodyBuffer_, pos);
        this.int64s_ = IppInt64.UnstuffArray(this.bodyBuffer_, pos);
        this.doubles_ = IppDouble.UnstuffArray(this.bodyBuffer_, pos);
        this.strings_ = IppString.UnstuffArray(this.bodyBuffer_, pos);
        this.props_ = IppProp.UnstuffArray(this.bodyBuffer_, pos);
        this.bytes_ = IppByteArray.Unstuff(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(": ResDev1 ");
        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");
        IppInt.PrintArray(tf, "ints: ", this.ints_);
        IppInt64.PrintArray(tf, "int64s: ", this.int64s_);
        IppDouble.PrintArray(tf, "doubles: ", this.doubles_);
        IppString.PrintArray(tf, "strings: ", this.strings_);
        IppProp.PrintArray(tf, "props: ", this.props_);
        IppByteArray.Print(tf, "bytes: ", this.bytes_);
    }

    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("ResDev1                       ");
        buffer.append("[ints: " + String.valueOf(this.ints_) + "],");
        buffer.append("[int64s: " + String.valueOf(this.int64s_) + "],");
        buffer.append("[doubles: " + String.valueOf(this.doubles_) + "],");
        buffer.append("[strings: " + String.valueOf(this.strings_) + "],");
        buffer.append("[props: " + String.valueOf(this.props_) + "],");
        buffer.append("[bytes: " + String.valueOf(this.bytes_) + "],");
        return buffer.toString();
    }

    public int[] ints() {
        return this.ints_;
    }

    public long[] int64s() {
        return this.int64s_;
    }

    public double[] doubles() {
        return this.doubles_;
    }

    public String[] strings() {
        return this.strings_;
    }

    public IppProp[] props() {
        return this.props_;
    }

    public byte[] bytes() {
        return this.bytes_;
    }
}