⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contexttest.java

📁 270的linux说明
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		if ( !myStorageInstance.TotalPhysicalMemory.IsNull() )		{			long value = myStorageInstance.TotalPhysicalMemory.GetValue();			strBuf.append("TotalPhysicalMemory: ").append(value).append("\n");		}		if ( !myStorageInstance.FreePhysicalMemory.IsNull() )		{			long value = myStorageInstance.FreePhysicalMemory.GetValue();			strBuf.append("FreePhysicalMemory: ").append(value).append("\n");		}		// methods        		       		long iLatency = myStorageInstance.GetAvailableSpace( path );		strBuf.append("getAvailableSpace of ").append(path).append(": ")				.append(iLatency).append("\n");		      		strBuf.append("------------ Storage Context ------------\n\n");		System.out.print( strBuf.toString() );	}    public void printBandwidthInfo() throws IntelMobileException    {        BandwidthInstance myBWInstance = (BandwidthInstance) myClass.GetInstance("Bandwidth");                StringBuffer strBuf = new StringBuffer();        strBuf.append("\n------------  Output Bandwidth Context ------------\n");        String type = myBWInstance.GetType();        strBuf.append("Type: ").append(type).append("\n");        String key = myBWInstance.GetKey();        strBuf.append("Key: ").append(key).append("\n");        if ( !myBWInstance.TheoreticalSystemRateTx.IsNull() )        {            float value = myBWInstance.TheoreticalSystemRateTx.GetValue();            strBuf.append("TheoreticalSystemRateTx: ").append(value).append("\n");        }                if ( !myBWInstance.TheoreticalSystemRateRx.IsNull() )        {            float value = myBWInstance.TheoreticalSystemRateRx.GetValue();            strBuf.append("TheoreticalSystemRateRx: ").append(value).append("\n");        }                if ( !myBWInstance.SystemRateTx.IsNull() )        {            float value = myBWInstance.SystemRateTx.GetValue();            strBuf.append("SystemRateTx: ").append(value).append("\n");        }                if ( !myBWInstance.SystemRateRx.IsNull() )        {            float value = myBWInstance.SystemRateRx.GetValue();            strBuf.append("SystemRateRx: ").append(value).append("\n");        }                if ( !myBWInstance.FastestProtocol.IsNull() )        {            String value = myBWInstance.FastestProtocol.GetValue();            strBuf.append("FastestProtocol: ").append(value).append("\n");        }                // --------- create socket and let LSP insert into bwdb ---------                // TCP        /*Socket sock;                new Thread() {            public void run() {                try {                    ServerSocket ss = new ServerSocket(5432);                    Socket s = ss.accept();                                        //s.getInputStream().read();                    DataInputStream dis = new DataInputStream(s.getInputStream());                    System.out.println("Socket Received: " + dis.readUTF());                                        s.close();                    ss.close();                } catch (Exception ex) {                    ex.printStackTrace();                }            }        }.Start();                try {            sock = new Socket("localhost", 5432);                        DataOutputStream dos = new DataOutputStream(sock.getOutputStream());            dos.writeUTF("hello");        } catch (Exception ex) {            ex.printStackTrace();            return;        }*/                // UDP        DatagramSocket sock;                new Thread() {            public void run() {                try {                    DatagramSocket ss = new DatagramSocket(5432);                                        byte[] buf = new byte[10];                    DatagramPacket p = new DatagramPacket(buf, 5);                    ss.receive(p);                                        System.out.println("DatagramSocket Received: " + new String(p.getData()));                                        ss.close();                } catch (Exception ex) {                    ex.printStackTrace();                }            }        }.start();                try {            sock = new DatagramSocket();                        byte[] buf = "hello".getBytes();            DatagramPacket p = new DatagramPacket(buf, buf.length, InetAddress.getLocalHost(), 5432);            sock.send(p);        } catch (Exception ex)        {            ex.printStackTrace();            return;        }                // --------- create socket and let LSP insert into bwdb ---------                // process level                if ( !myBWInstance.LimitTx.IsNull() )        {            float value = myBWInstance.LimitTx.GetValue();            strBuf.append("LimitTx: ").append(value).append("\n");        }                if ( !myBWInstance.LimitRx.IsNull() )        {            float value = myBWInstance.LimitRx.GetValue();            strBuf.append("LimitRx: ").append(value).append("\n");        }                if ( !myBWInstance.PercentTx.IsNull() )        {            float value = myBWInstance.PercentTx.GetValue();            strBuf.append("PercentTx: ").append(value).append("\n");        }                if ( !myBWInstance.PercentRx.IsNull() )        {            float value = myBWInstance.PercentRx.GetValue();            strBuf.append("PercentRx: ").append(value).append("\n");        }                if ( !myBWInstance.RateTx.IsNull() )        {            float value = myBWInstance.RateTx.GetValue();            strBuf.append("RateTx: ").append(value).append("\n");        }                if ( !myBWInstance.RateRx.IsNull() )        {            float value = myBWInstance.RateRx.GetValue();            strBuf.append("RateRx: ").append(value).append("\n");        }                if ( !myBWInstance.LimitedTx.IsNull() )        {            boolean value = myBWInstance.LimitedTx.GetValue();            strBuf.append("LimitedTx: ").append(value).append("\n");        }                if ( !myBWInstance.LimitedRx.IsNull() )        {            boolean value = myBWInstance.LimitedRx.GetValue();            strBuf.append("LimitedRx: ").append(value).append("\n");        }                if ( !myBWInstance.Adaptive.IsNull() )        {            boolean value = myBWInstance.Adaptive.GetValue();            strBuf.append("Adaptive: ").append(value).append("\n");        }                if ( !myBWInstance.AdaptivelyLimitable.IsNull() )        {            boolean value = myBWInstance.AdaptivelyLimitable.GetValue();            strBuf.append("AdaptivelyLimitable: ").append(value).append("\n");        }                // methods        strBuf.append("\n");                strBuf.append("setSessionLimitTx: ")        	.append(myBWInstance.SetSessionLimitTx(sock, 1000)).append("\n");                strBuf.append("setSessionLimitRx: ")    		.append(myBWInstance.SetSessionLimitRx(sock, 1000)).append("\n");                strBuf.append("setSessionPercentTx: ")    		.append(myBWInstance.SetSessionPercentTx(sock, 60)).append("\n");                strBuf.append("setSessionPercentRx: ")    		.append(myBWInstance.SetSessionPercentRx(sock, 60)).append("\n");                strBuf.append("getSessionLimitTx: ")    		.append(myBWInstance.GetSessionLimitTx(sock)).append("\n");                strBuf.append("getSessionLimitRx: ")			.append(myBWInstance.GetSessionLimitRx(sock)).append("\n");                strBuf.append("getSessionRateTx: ")			.append(myBWInstance.GetSessionRateTx(sock)).append("\n");                strBuf.append("getSessionRateRx: ")			.append(myBWInstance.GetSessionRateRx(sock)).append("\n");                strBuf.append("getSessionAdaptivelyLimitable: ")			.append(myBWInstance.GetSessionAdaptivelyLimitable(sock)).append("\n");                strBuf.append("getSessionAdaptive: ")			.append(myBWInstance.GetSessionAdaptive(sock)).append("\n");                strBuf.append("setSessionLimitedTx: ")			.append(myBWInstance.SetSessionLimitedTx(sock, true)).append("\n");                strBuf.append("setSessionLimitedRx: ")			.append(myBWInstance.SetSessionLimitedRx(sock, true)).append("\n");                strBuf.append("getEffectiveSessionLimitTx (SessionLimitedTx enabled): ")			.append(myBWInstance.GetEffectiveSessionLimitTx(sock)).append("\n");                strBuf.append("getEffectiveSessionLimitRx (SessionLimitedRx enabled): ")			.append(myBWInstance.GetEffectiveSessionLimitRx(sock)).append("\n");                strBuf.append("getSessionLimitedTx (after set true): ")			.append(myBWInstance.GetSessionLimitedTx(sock)).append("\n");                strBuf.append("getSessionLimitedRx (after set true): ")			.append(myBWInstance.GetSessionLimitedRx(sock)).append("\n");                strBuf.append("setSessionLimitedTx: ")			.append(myBWInstance.SetSessionLimitedTx(sock, false)).append("\n");                strBuf.append("setSessionLimitedRx: ")			.append(myBWInstance.SetSessionLimitedRx(sock, false)).append("\n");                strBuf.append("getEffectiveSessionLimitTx (SessionLimitedTx disabled): ")			.append(myBWInstance.GetEffectiveSessionLimitTx(sock)).append("\n");                strBuf.append("getEffectiveSessionLimitRx (SessionLimitedRx disabled): ")			.append(myBWInstance.GetEffectiveSessionLimitRx(sock)).append("\n");                strBuf.append("getSessionLimitedTx (after set false): ")			.append(myBWInstance.GetSessionLimitedTx(sock)).append("\n");                strBuf.append("getSessionLimitedRx (after set false): ")			.append(myBWInstance.GetSessionLimitedRx(sock)).append("\n");                strBuf.append("------------ Bandwidth Context ------------\n\n");        System.out.print( strBuf.toString() );                try {            sock.close();        } catch (Exception ex) {            ex.printStackTrace();        }    }}

⌨️ 快捷键说明

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