首先請原諒我,如果我誤認爲阻塞是如何工作的,我的理解阻塞會暫停線程直到它準備好,例如當讀取用戶輸入時,程序將等待直到用戶返回。 我的問題是,而不是等待數據變得可用,它讀取值爲0的字節。有沒有辦法阻止,直到數據becoms可用? readBytes方法在循環中調用。 public byte[] readBytes(){
try{
//read the head int that
我想創建一個小型應用程序,可以通過套接字發送文本日誌。當套接字被接受時,該套接字的輸入流將被存儲在像這樣的HashMap中。 private HashMap<Integer,InputStream> allinputsstreams = new
HashMap<Integer,InputStream>();
之後,我將創建一個新的JFrame對於當前的InputStream public L
我有以下類: public class Prices {
String priceValues;
public String getPriceValues() {
return priceValues;
}
public void setPriceValues(String priceValues) {
this.priceVa