⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msghead.java

📁 短信服务的源码,可以连接联通SMG等短信网关进行短信发送
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name:   MsgHead.java

package spApi;

import java.io.*;

// Referenced classes of package spApi:
//            SGIP_Command

public class MsgHead
{

    public byte Head[];
    private int TotalLength;
    private int CommandID;
    private long Seq_1;
    private int Seq_2;
    private int Seq_3;
    private byte tempbytes[];

    public MsgHead(byte abyte0[])
    {
        boolean flag = false;
        Head = new byte[20];
        for(int i = 0; i < 20; i++)
            Head[i] = abyte0[i];

        TotalLength = SGIP_Command.Bytes4ToInt(Head);
        tempbytes = (new byte[] {
            Head[4], Head[5], Head[6], Head[7]
        });
        CommandID = SGIP_Command.Bytes4ToInt(tempbytes);
        tempbytes = (new byte[] {
            Head[8], Head[9], Head[10], Head[11]
        });
        Seq_1 = SGIP_Command.Bytes4ToLong(tempbytes);
        tempbytes = (new byte[] {
            Head[12], Head[13], Head[14], Head[15]
        });
        Seq_2 = SGIP_Command.Bytes4ToInt(tempbytes);
        tempbytes = (new byte[] {
            Head[16], Head[17], Head[18], Head[19]
        });
        Seq_3 = SGIP_Command.Bytes4ToInt(tempbytes);
    }

    public MsgHead()
    {
        Head = new byte[20];
    }

    public MsgHead(int i, int j, long l, int k, int i1)
    {
        boolean flag = false;
        Head = new byte[20];
        TotalLength = i;
        CommandID = j;
        Seq_1 = l;
        Seq_2 = k;
        Seq_3 = i1;
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(i), Head, 0, 3, 0);
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(j), Head, 0, 3, 4);
        SGIP_Command.BytesCopy(SGIP_Command.LongToBytes4(l), Head, 0, 3, 8);
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(k), Head, 0, 3, 12);
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(i1), Head, 0, 3, 16);
    }

    public void setTotalLength(int i)
    {
        TotalLength = i;
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(i), Head, 0, 3, 0);
    }

    public void setCommandID(int i)
    {
        CommandID = i;
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(i), Head, 0, 3, 4);
    }

    public void setSeq_1(long l)
    {
        Seq_1 = l;
        SGIP_Command.BytesCopy(SGIP_Command.LongToBytes4(l), Head, 0, 3, 8);
    }

    public void setSeq_2(int i)
    {
        Seq_2 = i;
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(i), Head, 0, 3, 12);
    }

    public void setSeq_3(int i)
    {
        Seq_3 = i;
        SGIP_Command.BytesCopy(SGIP_Command.IntToBytes4(i), Head, 0, 3, 16);
    }

    public int getTotalLength()
    {
        return TotalLength;
    }

    public int getCommandID()
    {
        return CommandID;
    }

    public long getSeq_1()
    {
        return Seq_1;
    }

    public int getSeq_2()
    {
        return Seq_2;
    }

    public int getSeq_3()
    {
        return Seq_3;
    }

    public int write(OutputStream outputstream)
    {
        boolean flag = false;
        try
        {
            outputstream.write(Head);
        }
        catch(Exception exception)
        {
            System.out.println(exception.toString());
            return -1;
        }
        return 0;
    }

    public int read(InputStream inputstream)
    {
        System.out.println("--------MsgHead.read 消息头读取---------------");
        byte abyte0[] = new byte[4];
        try
        {
            inputstream.read(abyte0);
            SGIP_Command.BytesCopy(abyte0, Head, 0, 3, 0);
            TotalLength = SGIP_Command.Bytes4ToInt(abyte0);
            System.out.println("--------MsgHead.read TotalLength:" + TotalLength);
            inputstream.read(abyte0);
            SGIP_Command.BytesCopy(abyte0, Head, 0, 3, 4);
            CommandID = SGIP_Command.Bytes4ToInt(abyte0);
            System.out.println("--------MsgHead.read CommandID:" + CommandID);
            inputstream.read(abyte0);
            SGIP_Command.BytesCopy(abyte0, Head, 0, 3, 8);
            Seq_1 = SGIP_Command.Bytes4ToLong(abyte0);
            System.out.println("--------MsgHead.read Seq_1:" + Seq_1);
            inputstream.read(abyte0);
            SGIP_Command.BytesCopy(abyte0, Head, 0, 3, 12);
            Seq_2 = SGIP_Command.Bytes4ToInt(abyte0);
            System.out.println("--------MsgHead.read Seq_2:" + Seq_2);
            inputstream.read(abyte0);
            SGIP_Command.BytesCopy(abyte0, Head, 0, 3, 16);
            Seq_3 = SGIP_Command.Bytes4ToInt(abyte0);
            System.out.println("--------MsgHead.read Seq_3:" + Seq_3);
        }
        catch(Exception exception)
        {
            System.out.println("---MsgHead.read 错误:"+exception.toString());
            return -1;
        }
        return 0;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -