Java 過濾不安全字元

2021-04-18 11:06:50 字數 548 閱讀 9324

public static string htmlencode(string pstrword)

{ if((pstrword != null)&&(pstrword != ""))

{ stringbuffer pobjbuffer = new stringbuffer();

int j = pstrword.length();

for (int i = 0; i < j; i++)

{ char c = pstrword.charat(i);

switch (c)

{ case 60 :

break;

case 62 :

break;

case 38 :

break;

case 34 :

break;

case 169 :

break;

case 174 :

break;

case 165 :

break;

case 8364 :

執行緒不安全

背景 執行緒不安全 sleep 模擬網路延遲 後多執行緒併發訪問同乙個資源 方法1 同步 塊 語法 synchronized 同步鎖 catch interruptedexception e 方法2 同步方法 使用synchronizd修飾的方法,就叫同步方法,保證a執行緒執行該方法的時候,其他執行...

執行緒安全與不安全

list介面下面有兩個實現 乙個是arraylist 另外乙個是vector 從原始碼的角度來看 vector的方法前加了,synchronized 關鍵字,也就是同步的意思,sun公司希望vector是執行緒安全的,而希望arraylist是高效的,缺點就是另外的優點。在 items size 的...

執行緒安全 不安全

hashmap 執行緒不安全 可以用concurrenthashmap,arraylist也有concurrent hashtable 執行緒安全,給每個方法都加上了synchronnized關鍵字。和concurrenthashmap的區別是加鎖粒度不同,不是很懂。stringbuilder 執行...