📄 estadodisco.java
字号:
/** LiMon-JClient * Copyright (C) 2006 Marcelo Busico * * Author: Marcelo Busico marcelobusico@gmail.com * * This program is free software which I release under the GNU General Public * License. You may redistribute and/or modify this program under the terms * of that license as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. Version 2 is in the * LICENSE.txt file in the top level directory of this distribution. * * To get a copy of the GNU General Puplic License, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package limonclient;import java.io.*;public class EstadoDisco { private int raizTotal; private int raizUsado; private int raizLibre; private int homeTotal; private int homeUsado; private int homeLibre; /** Crea una nueva instancia de EstadoDisco */ public EstadoDisco() { } /** Devuelve el espacio Total en Particion Raiz en MB */ public int getRaizTotal() { return (int)(raizTotal/1024); } /** Devuelve el espacio Usado en Particion Raiz en MB */ public int getRaizUsado() { return (int)(raizUsado/1024); } /** Devuelve el espacio Libre en Particion Raiz en MB */ public int getRaizLibre() { return (int)(raizLibre/1024); } /** Devuelve el espacio Total en Particion Home en MB */ public int getHomeTotal() { return (int)(homeTotal/1024); } /** Devuelve el espacio Usado en Particion Home en MB */ public int getHomeUsado() { return (int)(homeUsado/1024); } /** Devuelve el espacio Libre en Particion Home en MB */ public int getHomeLibre() { return (int)(homeLibre/1024); } /** Devuelve toda la informacion del objeto en una cadena */ public String toString() { return ("ESPACIO EN DISCO: RAIZ: " + raizTotal + " KB Total, " + raizUsado + " KB Usados, " + raizLibre + " KB Libres\nESPACIO EN DISCO: HOME: " + homeTotal + " KB Total, " + homeUsado + " KB Usados, " + homeLibre + " KB Libres"); } /** Recibe los atributos del objeto desde la conexion * Demora: 50 lecturas en 6 segundos */ public void recibirObjeto(Conexion con) throws IOException { //Envia peticion Cabecera envCab=new Cabecera(Cabecera.IdPedirEstadoDisco,con.getPassword()); envCab.enviarCabecera(con.getSalida()); //Recibe cabecera del servidor Cabecera recCab=new Cabecera(); recCab.recibirCabecera(con.getEntrada()); //Verifica que la cabecera sea la solicitada if(recCab.getIdentificador()==Cabecera.IdDevolverEstadoDisco) { raizTotal=con.getEntrada().readInt(); raizUsado=con.getEntrada().readInt(); raizLibre=con.getEntrada().readInt(); homeTotal=con.getEntrada().readInt(); homeUsado=con.getEntrada().readInt(); homeLibre=con.getEntrada().readInt(); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -