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

📄 socketsender.java

📁 手机网游巨商王的客户端代码
💻 JAVA
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2006-10-19 15:30:01
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 

import java.io.IOException;
import java.io.OutputStream;

public class SocketSender extends Thread
{

    public SocketSender(OutputStream outputstream)
    {
        _fldif = outputstream;
        a = new byte[2048];
        _fldfor = 0;
        start();
    }

    public synchronized void a(int i, String s)
    {
        int k = s.length();
        byte abyte0[] = new byte[k * 2];
        for(int j = 0; j < k; j++)
        {
            abyte0[2 * j] = (byte)(s.charAt(j) % 256);
            abyte0[2 * j + 1] = (byte)(s.charAt(j) / 256);
        }

        if(4 + abyte0.length > 2048)
        {
            return;
        } else
        {
            a[_fldfor] = (byte)(abyte0.length % 256);
            a[_fldfor + 1] = (byte)((abyte0.length / 256) % 256);
            a[_fldfor + 2] = (byte)(i % 256);
            a[_fldfor + 3] = (byte)((i / 256) % 256);
            System.arraycopy(abyte0, 0, a, _fldfor + 4, abyte0.length);
            _fldfor += 4 + abyte0.length;
            notify();
            return;
        }
    }

    public synchronized void a(int i, byte abyte0[], int j)
    {
        a[_fldfor] = (byte)(j % 256);
        a[_fldfor + 1] = (byte)((j / 256) % 256);
        a[_fldfor + 2] = (byte)(i % 256);
        a[_fldfor + 3] = (byte)((i / 256) % 256);
        if(j > 0)
            System.arraycopy(abyte0, 0, a, _fldfor + 4, j);
        _fldfor += 4 + j;
        notify();
    }

    public synchronized void run()
    {
        do
        {
            if(_fldfor == 0)
                try
                {
                    wait();
                }
                catch(InterruptedException interruptedexception) { }
            if(_fldfor != 0)
            {
                try
                {
                    _fldif.write(a, 0, _fldfor);
                    _fldif.flush();
                }
                catch(IOException ioexception) { }
                _fldfor = 0;
            } else
            {
                return;
            }
        } while(true);
    }

    public synchronized void stop()
    {
        _fldfor = 0;
        a = null;
        notify();
    }

    final int _flddo = 2048;
    private OutputStream _fldif;
    private byte a[];
    private int _fldfor;
}

⌨️ 快捷键说明

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