用java来实现c#中的一些类和方法

来源:互联网 发布:百事淘宝网 编辑:程序博客网 时间:2024/05/18 20:05

C#:Array.Copy(a, 0, b, 0, 4);
java:  System.arraycopy(a, 0, b, 0, 4);


c#: Sockedt.Send(byte[] buffer, int size, SocketFlags socketFlags);
java:public void Send(byte[] prebuffer, int size) throws Exception 
    {
        try 
        {
        byte[] sendBuffer = new byte[size];
        for(int i=0;i<size;i++){
        sendBuffer[i]=prebuffer[i];
        }
            output.write(sendBuffer);
            output.flush();
        } 
        catch (Exception e) 
        {
            e.printStackTrace();
            if (output != null)
            output.close();
            throw e;
        } 
        
    }