package com.pp.test;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Date;
/**
*
* @author <a href="mailto:zhangjun@pegasus-se.com">ZhangJun</a>
* @date 2010/05/14
*/
public class Logon implements Serializable {
private static final long serialVersionUID = 4274726103149096976L;
/***/
private Date date = new Date();
/***/
private String username;
/** transient 是用于声明序列化的时候不被存储的 */
private transient String password;
Logon(String name, String pwd) {
this.username = name;
this.password = pwd;
}
public String toString() {
return "logon info: \n " + "username: " + this.username + "\n date: "
+ this.date.toString() + "\n password: " + this.password;
}
public static void main(String[] args) {
Logon logon = new Logon("junzi", "password");
System.out.println(logon);
try {
ObjectOutputStream o = new ObjectOutputStream(new FileOutputStream(
"Logon.out"));
o.writeObject(logon);
o.close();
//
int seconds = 5;
long t = System.currentTimeMillis() + seconds * 1000;
while (System.currentTimeMillis() < t)
;
//
ObjectInputStream in = new ObjectInputStream(new FileInputStream(
"Logon.out"));
System.out.println("========================================");
System.out.println("Recovering object at " + new Date());
System.out.println("========================================");
logon = (Logon) in.readObject();
System.out.println(logon);
} catch (Exception e) {
e.printStackTrace();
}
}
}
分享到:
相关推荐
The test results demonstrate the superiority of the both DL algorithms over other methods in the application of power system transient disturbance classification. Keywords—Convolutional Neural ...
EMTDC Transient Analysis for PSCAD Power System Simulation.
TRANSIENT仿真(以共射放大器为例)工程
The effects of surface wettability, from superhydrophilic to superhydrophobic, on transient pool boiling of water under atmospheric pressure were experimentally examined by means of the quenching ...
Road vehicles — Electrical disturbances from conduction and coupling — Part 2: Electrical transient conduction along supply lines only 道路车辆—传导和耦合引起的电气干扰—第 2 部分:仅沿电源线的...
Transient Voltage Suppressors (TVS’s) are devices used to protect vulnerable circuits from electrical overstress such as that caused by electrostatic discharge, inductive load switching and induced ...
JAVA中transient关键字的讲解
transient是Java语言的关键字,用来表示一个域不是该对象串行化的一部分。当一个对象被串行化的时候,
Java中的transient关键字
java关键字transient
标题:Transient analysis of 1D inhomogeneous media by dynamic inhomogeneous finite element method 基于动态非均匀有限元方法的一维非均匀介质瞬态分析
applications requiring transient overvoltage protection capability. It is intended for use in voltage and ESD sensitive equipment such as computers, printers, business machines, communication systems ...
传热学小案列,一维非稳态传热分析,推荐大家学习
transient stability matlab
《Discrete Oscillator Design Linear, Nonlinear, Transient, and Noise Domains》,是一本振荡器设计比较新的书籍,内容使用。
DC Circuits Transient Circuits –2nd Order circuits
transient stability model
THERMAL TRANSIENT ANALYSIS
TRANSIENT STABILITY STUDIES