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

import com.scene7.is.ipp.messages.Ipp;
import java.io.IOException;
import java.io.Writer;

public abstract class Message {
    public static final int ISCORE = 1;
    public static final int ISDB = 2;
    public static int MessageNumber = -1;
    protected int tag_;
    protected int headerClientId_;
    protected byte[] headBuffer_;
    protected byte[] bodyBuffer_;
    protected int messageLength_;

    public abstract int classification();

    public boolean isCore() {
        return this.classification() == 1;
    }

    public boolean isDb() {
        return this.classification() == 2;
    }

    public abstract void print(Writer var1, String var2) throws IOException;

    public abstract void process(int var1, int var2, byte[] var3);

    public byte[] headBuffer() {
        return this.headBuffer_;
    }

    public byte[] bodyBuffer() {
        return this.bodyBuffer_;
    }

    public int length() {
        return this.messageLength_;
    }

    public int id() {
        return MessageNumber;
    }

    public int headerClientId() {
        return this.headerClientId_;
    }

    public void stuffClientId(int cid) {
        this.headerClientId_ = cid;
        if (this.headBuffer_ != null) {
            Ipp.StuffIntDirect(this.headBuffer_, 0, this.headerClientId_);
        }
    }

    public void stuffTag(int tag) {
        this.tag_ = tag;
        if (this.headBuffer_ != null) {
            Ipp.StuffIntDirect(this.headBuffer_, 4, this.tag_);
        }
    }

    public final int tag() {
        return this.tag_;
    }
}