dbaccount.java~

来自「网上斗地主的JAVA源码,可以学习一下. J2EE项目开发实例源代码」· JAVA~ 代码 · 共 59 行

JAVA~
59
字号
package poker;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */
import java.io.*;

 class DbRecord {
  static String serverName;
  static String address;
  static String ServerID;
  static byte[] recordByte=new byte[60];

  public static void set(String serverName,String address,String ServerID){
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    DataOutputStream dos=new DataOutputStream(baos);
    OutputStream os;
    OutputStreamWriter osw=new OutputStreamWriter(dos);

    try{
      osw.flush();
      dos.writeUTF(serverName);
      dos.writeUTF(address);
      dos.writeUTF(ServerID);
      dos.flush();
      baos.flush();
      recordByte=baos.toByteArray();
      osw.close();
      dos.close();
      baos.close();
    }catch (IOException e){
    //
    }

  }

  public static void get(byte[] b){
    DataInputStream dis=new DataInputStream(new ByteArrayInputStream(b));
    InputStreamReader isr=new InputStreamReader(dis);
    try{
      //ServiceConnection  ss=new ServiceConnection(this,this.se);
      serverName=dis.readUTF();
      address=dis.readUTF();
      ServerID=dis.readUTF();
      isr.close();
      dis.close();
    }catch (IOException e){
      //
    }

  }


}

⌨️ 快捷键说明

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