📄 setsysconfig.java
字号:
/* * Author : 胡家宝 * Date : 2006-6-30 10:54:52 */ package WebExam; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.*; public class SetSysConfig{ private int m_Auto_Id; private String m_KeyType; private String m_KeyName; private String m_KeyValue; private String m_KeyDescribe; public SetSysConfig() { } public SetSysConfig(int Auto_Id,String KeyType,String KeyName,String KeyValue,String KeyDescribe) { m_Auto_Id = Auto_Id; m_KeyType = KeyType; m_KeyName = KeyName; m_KeyValue = KeyValue; m_KeyDescribe = KeyDescribe; } public int getAuto_Id() { return m_Auto_Id; } public void setAuto_Id( int Auto_Id ) { m_Auto_Id = Auto_Id; } public String getKeyType() { return m_KeyType; } public void setKeyType( String KeyType ) { if( KeyType == null ) KeyType= "default"; m_KeyType = KeyType; } public String getKeyName() { return m_KeyName; } public void setKeyName( String KeyName ) { if( KeyName == null ) KeyName= "default"; m_KeyName = KeyName; } public String getKeyValue() { return m_KeyValue; } public void setKeyValue( String KeyValue ) { if( KeyValue == null ) KeyValue= "default"; m_KeyValue = KeyValue; } public String getKeyDescribe() { return m_KeyDescribe; } public void setKeyDescribe( String KeyDescribe ) { if( KeyDescribe == null ) KeyDescribe= "default"; m_KeyDescribe = KeyDescribe; } //序列化 public byte[] serialize() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(bout); dout.writeInt( m_Auto_Id ); dout.writeUTF( m_KeyType ); dout.writeUTF( m_KeyName ); dout.writeUTF( m_KeyValue ); dout.writeUTF( m_KeyDescribe ); return bout.toByteArray(); } //反序列化 public void deserialize(byte[] data) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(data); DataInputStream din = new DataInputStream(bin); m_Auto_Id = din.readInt(); m_KeyType = din.readUTF(); m_KeyName = din.readUTF(); m_KeyValue = din.readUTF(); m_KeyDescribe = din.readUTF(); bin.close(); din.close(); } public static boolean matches(byte[] data, String userName) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(data); DataInputStream dis = new DataInputStream(bais); try { return (dis.readUTF()).equals(userName); } catch (IOException e) { e.printStackTrace(); return false; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -