通過本機存放區的一個值和當前擷取值得比較得到一個boolean值,當前boolean

來源:互聯網
上載者:User

通過本機存放區的一個值和當前擷取值得比較得到一個boolean值,當前boolean
   /**
     * Sets the port of the local Socks5 proxy. Default is 7777. If you set the port to a negative
     * value Smack tries the absolute value and all following until it finds an open port.
     * 
     * @param localSocks5ProxyPort the port of the local Socks5 proxy to set
     */
    public static void setLocalSocks5ProxyPort(int localSocks5ProxyPort) {
        SmackConfiguration.localSocks5ProxyPort = localSocks5ProxyPort;
    }
JAVA中怎將byte轉換為一個長度為8的boolean數組(每bit代表一個boolean值)

速度快的方案

import java.util.Arrays;

public class ByteToBooleanArray {
/**
* 將byte轉換為一個長度為8的boolean數組(每bit代表一個boolean值)
*
* @param b byte
* @return boolean數組
*/
public static boolean[] getBooleanArray(byte b) {
boolean[] array = new boolean[8];
for (int i = 7; i >= 0; i--) { //對於byte的每bit進行判定
array[i] = (b & 1) == 1; //判定byte的最後一位是否為1,若為1,則是true;否則是false
b = (byte) (b >> 1); //將byte右移一位
}
return array;
}

public static void main(String[] args) {
byte b = 0x35; // 0011 0101
System.out.println(Arrays.toString(getBooleanArray(b)));
}
}
 
as 30 怎在本機存放區資訊的問題

樓上說的是把資料存進Cook裡面了,cook被清除了就沒有了。

目前flash在各方個面的應用越來越廣,而flash也不單只是注重自身絢麗的效果,也需要和外界程式交換資料,以實現更強大的功能,隨著as3的到來,flash和外部互動的方式也越來越簡便和合理化。今天就在這裡談談as3和後台資料的互動(這裡選擇as3+php架構,其他配置同理)。

在as3裡,原來的loadVars方法已經被廢棄,而改用一系列的類來實現與後台資料的互動,這些類是:URLLoader,URLLoaderDataFormat,URLStream,URLVariables。
URLLoader 類和原來的loadVars類似,是載入文本,2進位資料,xml,URL資料等資訊的有力工具。URLLoader接受一個URLRequest 作為構造的參數,使用load方法來載入資料。URLLoder也可以進行監聽,這點也loadVars不同,一個簡單的樣本如下:
1. //actionscript code
2. var loader:URLLoader = new URLLoader();
3. //聲明一個URLRequest
4. var url:URLRequest = new URLRequest(”test.php”);
5. //設定傳輸方式為POST
6. url.method = URLRequestMethod.POST;
7. //聲明一個URLVariables
8. var values:URLVariables = new URLVariables();
9. //設定要傳輸的資訊
10. values.message=”hello im flash!”;
11. url.data = values;
12. //設定以變數-值配對的方式解析資料
13. loader.dataFormat = URLLoaderDataFormat.VARIABLES;
14. loader.addEventListener(Event.COMPLETE,loaded);
15. function loaded(e:Event){
16. trace(loader.data);
17. //outPut: phpMessage=im php message!&flashMessage=hello im flash!
18. trace(loader.data.phpMessage);
19. // im php message!
20. trace(loader.data.flashMessage);
21. // hello im flash!
22. }
23. loader.load(url);

1. //test.php code//
2. 3. $flashData = $_POST['message'];
4. $phpMessage = 'im php message!';
5. echo "phpMessage=$phpMessage&flashMessage=$flashData";
6. ?>

以上這些就是as3裡和後台互動的基礎內容,現在你可以在as3裡建立這樣的互動,擷取動態資料來豐富你的程式,在你開始自己動手......餘下全文>>
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.