fileattrs.java

来自「基于Java的FTP源码」· Java 代码 · 共 178 行

JAVA
178
字号
/* * @(#) FileAttrs * Copyright: Copyright (c) 2003,2004 Rad Inks (Pvt) Ltd. </p> * Company: Rad Inks (Pvt) Ltd.</p> *//* * License * * The contents of this file are subject to the Jabber Open Source License * Version 1.0 (the "JOSL").  You may not copy or use this file, in either * source code or executable form, except in compliance with the JOSL. You * may obtain a copy of the JOSL at http://www.jabber.org/ or at * http://www.opensource.org/. * * Software distributed under the JOSL is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the JOSL * for the specific language governing rights and limitations under the * JOSL. */package com.radinks.net;import java.util.Date;import java.text.DateFormat;/** * Manages Attributes of files on the server. * * @author Raditha Dissanayake * @version 1.1 */public class FileAttrs {	/**	 * dir is true if the current file is a directory	 */	boolean dir;	/**	 * file size	 */	private long size;	/**	 * inode number	 */    private int inode;	/**	 * Group Id	 */	private int GId;	/**	 * User Id	 */	private int UId;	/**	 * modification time.	 */	private long milli_seconds;	/**	 * default constructor.	 */    public FileAttrs() {    }	/**	 * Parses the flags for each file	 * @param s - Flags	 * @return not used at the moment.	 */	public boolean parseFlags(String s)	{		dir = (s.charAt(0) == 'd');		return false;		/** @todo fully implement this method */	}	/**	 *	 * @return true if the current file is a directory.	 */	public boolean isDir()	{		return dir;	}	/**	 *	 * @return size of the file	 */	public long getSize()	{		return size;	}	/**	 *	 * @return modification time of the file in milli seconds.	 */	public long getMTime()	{		return milli_seconds;	}	/**	 *	 * @return file owner's user id.	 */	public int getUId()	{		return UId;	}	/**	 *	 * @return group id.	 */	public int getGId()	{		return GId;	}	/**	 *	 * @return the modification time as a date string.	 */	public String  getMtimeString(){		Date date= new Date(milli_seconds);		return (date.toString());    }	/**	 * Not yet fully implemented.	 * @return the flags	 */	public int getFlags()	{		return 0;	}	/**	 *	 * @param inode	 */    public void setInode(int inode) {        this.inode = inode;    }	/**	 *	 * @return inode number for the current file.	 */    public int getInode() {        return inode;    }    public void setGId(int GId) {        this.GId = GId;    }    public void setUId(int UId) {        this.UId = UId;    }    public void setSize(long size) {        this.size = size;    }    public void setDir(boolean dir) {        this.dir = dir;    }	public void setTime(long seconds)	{		this.milli_seconds = seconds;	}}

⌨️ 快捷键说明

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