transferitem.java

来自「openacs source for CPE wan management」· Java 代码 · 共 51 行

JAVA
51
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package org.openacs;import java.util.Calendar;import java.util.Random;/** * * @author Administrator */public class TransferItem {    private static final long LIFE_TIME = 3600*1000; // lifetime in milis    private long timeCreated;    private String user;    private String password;    private Integer idHost;    private int type;    public final static int  UPLOAD_LOG = 1;    public final static int  UPLOAD_CONFIG = 2;    public final static int  DOWNLOAD_CONFIG = 3;    public TransferItem (int id, int type) {        byte [] rb = new byte [8];        Random r = new Random ();        r.nextBytes(rb);        user = Integer.toHexString(id)+Util.cvtHex(rb);        r.nextBytes(rb);        password = Util.cvtHex(rb);        this.type = type;        idHost = id;        timeCreated = Calendar.getInstance().getTimeInMillis();}    public String getUser () {        return user;    }    public String getPassword () {        return password;    }    public Integer getHostId () {        return idHost;    }    public boolean isExpired () {        return (Calendar.getInstance().getTimeInMillis() - timeCreated >LIFE_TIME);    }}

⌨️ 快捷键说明

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