DbAccount.java~
上传用户:haojie1228
上传日期:2022-08-08
资源大小:347k
文件大小:1k
源码类别:

通讯/手机编程

开发平台:

Java

  1. package poker;
  2. /**
  3.  * <p>Title: </p>
  4.  * <p>Description: </p>
  5.  * <p>Copyright: Copyright (c) 2004</p>
  6.  * <p>Company: </p>
  7.  * @author not attributable
  8.  * @version 1.0
  9.  */
  10. import java.io.*;
  11.  class DbRecord {
  12.   static String serverName;
  13.   static String address;
  14.   static String ServerID;
  15.   static byte[] recordByte=new byte[60];
  16.   public static void set(String serverName,String address,String ServerID){
  17.     ByteArrayOutputStream baos=new ByteArrayOutputStream();
  18.     DataOutputStream dos=new DataOutputStream(baos);
  19.     OutputStream os;
  20.     OutputStreamWriter osw=new OutputStreamWriter(dos);
  21.     try{
  22.       osw.flush();
  23.       dos.writeUTF(serverName);
  24.       dos.writeUTF(address);
  25.       dos.writeUTF(ServerID);
  26.       dos.flush();
  27.       baos.flush();
  28.       recordByte=baos.toByteArray();
  29.       osw.close();
  30.       dos.close();
  31.       baos.close();
  32.     }catch (IOException e){
  33.     //
  34.     }
  35.   }
  36.   public static void get(byte[] b){
  37.     DataInputStream dis=new DataInputStream(new ByteArrayInputStream(b));
  38.     InputStreamReader isr=new InputStreamReader(dis);
  39.     try{
  40.       //ServiceConnection  ss=new ServiceConnection(this,this.se);
  41.       serverName=dis.readUTF();
  42.       address=dis.readUTF();
  43.       ServerID=dis.readUTF();
  44.       isr.close();
  45.       dis.close();
  46.     }catch (IOException e){
  47.       //
  48.     }
  49.   }
  50. }