java中如何向集合內傳送數據

如果,你是在載入程序的時候,就向 集合內添加數據就用 靜態代碼
static { 在這里向集合里添加 }
如果,是在執行某一種動作後,向集合里添加數據,在執行動作額方法里 調用 集合的 add方法添加就可以了!

❷ java數組傳輸

socket只能接收位元組流
不管你什麼對象都可以用json表示出來 然後把這個String轉換成位元組流傳遞
socket收到的位元組流在轉換成String 再轉換成對象

❸ java怎樣從一個窗口發送數據到另外一個窗口

是想把值從f1傳到f2嗎?
假如想傳一個String類型的值
public void jf2(String str) {
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jb1) {
jf2("這里傳一個String類型的值");
}
}

❹ 你好,你知道怎麼用Java實現數據傳輸嗎

度知道

ik.qb=ik.qb||;A.user=;A.page=;A.extra=;returnelse}return""},add:function(C,B,D)if(!A[C][B])}else;if(.lang.isArray(B))elsereturn true}}return false}}})();

.dom.ready(function(){
ik.qb.push.show({

pushListNum:'0'
,pushOffset:'0'
,userType:'cookie'

,moreUrl:'/browse/?lm=17'
,pushQuestion:[

{
answerNum:'0'
,qid:'249830205'
,score:'0'
,questionType:'ql'
,questionTitle:'請問一下關於Arcgis engine 的問題,'
,questionTitFull:'請問一下關於Arcgis engine 的問題,'
,cellphone:'0'
},

{
answerNum:'0'
,qid:'249829667'
,score:'0'
,questionType:'ql'
,questionTitle:'在S2SH的框架中,按id查詢時出的node to traverse cannot be null!是...'
,questionTitFull:'在S2SH的框架中,按id查詢時出的node to traverse cannot be null!是什麼錯誤啊'
,cellphone:'0'
},

{
answerNum:'0'
,qid:'249828013'
,score:'30'
,questionType:'ql'
,questionTitle:'求解HQL的更新方法。'
,questionTitFull:'求解HQL的更新方法。'
,cellphone:'0'
},

{
answerNum:'0'
,qid:'249827575'
,score:'5'
,questionType:'ql'
,questionTitle:'java一個基礎的問題,如何從一個新的類里調用原來的類里的變數和變數值。'
,questionTitFull:'java一個基礎的問題,如何從一個新的類里調用原來的類里的變數和變數值。'
,cellphone:'0'
},

{
answerNum:'0'
,qid:'249827569'
,score:'0'
,questionType:'ql'
,questionTitle:'java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQ...'
,questionTitFull:'java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver'
,cellphone:'0'
},

{
answerNum:'2'
,qid:'249827426'
,score:'0'
,questionType:'ql'
,questionTitle:'在java中如何將全為數字的字元串轉化為byte數組?'
,questionTitFull:'在java中如何將全為數字的字元串轉化為byte數組?'
,cellphone:'0'
},

{
answerNum:'0'
,qid:'249826927'
,score:'0'
,questionType:'ql'
,questionTitle:'你好,你知道怎麼用Java實現數據傳輸嗎?'
,questionTitFull:'你好,你知道怎麼用Java實現數據傳輸嗎?'
,cellphone:'0'
},

{
answerNum:'1'
,qid:'249825070'
,score:'0'
,questionType:'ql'
,questionTitle:'有脂肪肝怎麼辦'
,questionTitFull:'有脂肪肝怎麼辦'
,cellphone:'0'
},
{}

]
});
});

|
|

知道

|

var EC_ASP=EC_ASP||{};
EC_ASP.TJstarttime=new Date().getTime();
if(Math.random()<1/200){
.dom.ready(function());
}

if(!g_f_js)

if (typeof(cf)=="function")

/**
* inc_data.js
* 存放qb頁面有關的數據信息
* 因為無法在fwui中打出來,只能在這里進行二次添加
*
* @author xiaoqiang
* @mail [email protected]
* @date
* @link
*/
(function (argument) {
if (ik.qb.data) {
ik.qb.data.add('page','imgCount','0');
ik.qb.data.add('page','hasAspAd','1');
ik.qb.data.add('user','uploadImg','0');
ik.qb.data.add('user','uploadMap','0');
ik.qb.data.add('user','msgNum','0');
ik.qb.data.add('user','uploadImgUserLevel','二');
var c = [];

c.push({
cid : 870,
cname : 'JAVA相關'
});

c.push({
cid : 1073,
cname : '程序設計'
});

c.push({
cid : 74,
cname : '電腦/網路'
});

ik.qb.data.add('page','cidArr',c);
/*
* 瀏連忘返項目 qb小流量實驗
* 如果是實驗的qid,則頁面展示實驗的tag和list
* 如果不是實驗的qid,則保持原狀不變
*
* @author guizi
*/
ik.qb.data.add('page','isLinger','0');
}
})();

> > >

Wireless Toolkit 2.5.2

懸賞分:5
|
解決時間:2009-3-3 19:08
|
提問者:

為什麼java me 叫這個名字呢?Wireless Toolkit 2.5.2
好像英文字母的頭一個字母都愛不上!

問題補充:
都是做什麼?個個都是做什麼的?

ik.qb.data.add('page','fromWap','0');

最佳答案

兩個在名字上沒啥關系...-_-!~

分享給你的朋友吧:

對我有幫助
0

回答時間:2009-2-28 12:54
|

回答者:

|

擅長領域:

暫未定製

參加的活動:

暫時沒有參加的活動

ik.qb.data.add('extra','bestAnswerIsGood','0');

相關內容

2010-12-24

2010-9-1

1

2010-8-15

1

2010-5-19

2010-3-12

查看同主題問題:

.i-exp-suc#exp-word.exp-mid

var exp=log.imageReq(E.join("&"))},getRelateExp:function(I));var D=E.getElementsByTagName("a");.each(D,function(M,L))})});return }if(typeof (I[0].eidEnc)=="string")var F=J[0];var B=.dom.create("li");exp.nslog(location.href,2000,);var D=A.getElementsByTagName("a");.each(D,function(M,L))});break;case"relative.more.click":.on(M,"click",function(N))});break;case"relative.taglist.click":.on(M,"click",function(N))});break}});var C=new Date(I.releaseTime*1000);var K=C.getFullYear()+"-";K+=(C.getMonth()+1)+"-";K+=C.getDate();var H=new Array();H.push(''+K+"");H.push('");H.push('');if(I.succNum>0)B.innerhtml=H.join("");.dom.insertBefore(B,F)}}};function getRelateExp(A)(function())}})();

其他回答
共1條

f

回答者:

|

|
2009-2-28 12:33

轉發到:

推廣鏈接

用戶名:

密碼碼:

記住我的登錄狀態

登錄

ik.qb.user.init();

if(!g_f_js)

if (typeof(cf_h)=="function")

(function(){
// 所有廣告開關 true:打開,false:關閉
var switcher = true;
var status = ik.qb.data.get('page','status');
var cidArr = ik.qb.data.get('page','cidArr');
if (switcher && /closed|finish|overe/.test(status)) {
var data = [
{
src : '',
url : '',
pos : 'down', // up表示在廣告位置上方,down表示下方
category : []
},{
src : '',
url : '',
pos : 'down',
category : []
},{
src : '',
url : '',
pos : 'down',
category : [83]
},{
src : '',
url : '',
pos : 'down',
category : [77]
},{
src : '',
url : '',
pos : 'down',
category : []
},{
src : '',
url : '',
pos : 'down',
category : []
},{
src : '',
url : '',
pos : 'down',
category : [1097]
},{
src : '',
url : '',
pos : 'down',
category : [74,95,1101]
}
];

function init(d) {
for (var i=0; i<d.length; i++) {
if (d[i].src != '') {
if (d[i]['category'].length == 0 || checkCategory(d[i]['category'])) {
build(d[i]);
}
}
}
}

// 檢查廣告需要存在的分類是否滿足
function checkCategory(category) {
var result = false;
.each(category, function(item){
.each(cidArr, function(c){
if (item == c['cid']) {
result = true;
}
});
});
return result;
}

// 生成內容部分
function build(data) {
var html = '';
if (.g('ad-brand-'+data['pos'])) {
.g('ad-brand-'+data['pos']).innerHTML = html;
} else {
var div = .dom.create('div',);
div.innerHTML = html;
var mark = (data['pos'] == 'up')? .dom.query('.l-aside .login-panel')[0] : .g('qb-ad-cpro');
.dom.insertAfter(div, mark);
}
}

init(data);
}
})();

.ad-fc-down

&;2011 Bai


if(G("usrbar-login")))}usrbar.tip.get(false);

❺ java中引用傳遞和值傳送的區別

其實畫一個內存圖就很清楚了,但是這里不能上傳圖片...
swap(String name0, String name1)
你可以寫成這樣考慮
swap(String str0, String str1)
發現了嗎?其實你傳入參數的過程是將str0和str1分別指向name0和name1所以引用的地址,也就是說方法里構造了兩個新的字元串,而你所做的賦值操作都是對新字元串的引用地址的改變...方法退出後name0和name1還是指向原來的地址,並沒有發生任何改變...(字元串類型是一個比較特別的類型,其中還涉及到字元串的不變性,在這里你可以把它考慮成簡單數據類型)

swap(String name[])
也可以這樣考慮
swap(String str[])
進入方法後構造了一個數組對象str[],並將str指向name的地址(強調:此時str和name指向同一內存地址),也就是說你對str[0],str[1]的改變就是在對name地址中name[0],name[1]的改變

真的很難表述清楚,自己畫個內存圖就很清晰了(理解的關鍵是:形參是新對象,而且新對象是指向傳入對象的地址)
ps: java 中不存在址傳遞,重新賦值其實是重定向
C 中存在址傳遞,傳遞進函數中的地址里所保存的值可以被改變

❻ java中流是怎樣傳輸的,詳細說一下中間的傳輸過程。謝謝啊

其實中間就是一個管道(信道)、緩沖存儲器,還有一些中間的程序(驅動程序)
比如你要把一寫數據寫到一個文件上面,那麼會經過如下的過程:
你的程序運行在Java虛擬機!》你的程序要寫入文件的數據(在java.exe進程內存中)!》Java虛擬機通過操作系統的文件系統調用》磁碟驅動程序》磁碟緩存器?》寫到磁碟記憶單元。
這就是我對Java向磁碟寫入文件數據的理解。其實這里就是一個向磁碟輸出數據的過程。

❼ JAVA 傳輸文件

//以前寫的一個文件傳輸的小程序,有客戶端和伺服器端兩部分,伺服器可//以一直運行,客戶端傳輸完一個後退出,當然你也可以根據你的需要改。
//伺服器端可以支持多個客戶端同時上傳,用到了多線程
/**
* 文件傳輸,客戶端
* @aurth anyx
*/
//package per.anyx.ftp;

import java.net.*;
import java.io.*;

public class FtpClient{
public static void main(String[] args){
if(args.length != 3){
System.out.println("Usage: FtpClient host_add host_port src_file");
System.exit(0);
}
File file = new File(args[2]);
if(!file.exists() || !file.isFile()){
System.out.println("File \"" + args[2] + "\" does not exist or is not a normal file.");
System.exit(0);
}
Socket s = null;
FileInputStream in = null;
OutputStream out = null;
try{
s = new Socket(args[0], Integer.parseInt(args[1]));
in = new FileInputStream(file);
out = s.getOutputStream();

byte[] buffer = new byte[1024*8];
int len = -1;
System.out.println("File tansfer statr...");
while((len=in.read(buffer)) != -1){
out.write(buffer, 0, len);
}
System.out.println("File tansfer complete...");
}catch(Exception e){
System.out.println("Error: " + e.getMessage());
System.exit(1);
}finally{
try{
if(in != null) in.close();
if(out != null) out.close();
if(s != null) s.close();
}catch(Exception e){}
}
}
}

/**
* 文件傳輸,伺服器端
* @aurth anyx
*/
//package per.anyx.ftp;

import java.net.*;
import java.io.*;

public class FtpServer{
public static void main(String[] args){
if(args.length != 1){
System.out.println("Usage: FtpServer server_port");
System.exit(0);
}
ServerSocket ss = null;
try{
ss = new ServerSocket(Integer.parseInt(args[0]));
System.out.println("FtpServer start on port ..." + args[0]);
while(true){
Socket s = ss.accept();
new FtpThread(s).start();
System.out.println(s.getInetAddress().getHostAddress() + " connected.");
}
}catch(Exception e){
System.out.println("Error: " + e.getMessage());
}finally{
try{
if(ss != null) ss.close();
}catch(Exception e){}
}
}
}

class FtpThread extends Thread{
Socket s;
long fileName = 0;
public FtpThread(Socket s){
this.s = s;
}
public void run(){
FileOutputStream out = null;
InputStream in = null;
File file = null;
do{
file = new File("" + (fileName++));
}while(file.exists());
try{
out = new FileOutputStream(file);
in = s.getInputStream();

byte[] buffer = new byte[1024*8];
int len = -1;
while((len=in.read(buffer)) != -1){
out.write(buffer, 0, len);
}
}catch(Exception e){
System.out.println("Error: " + e.getMessage());
}finally{
try{
if(in != null) in.close();
if(out != null) out.close();
if(s != null) s.close();
System.out.println(s.getInetAddress().getHostAddress() + " connect closed..");
}catch(Exception e){}
}
}
}

❽ java傳輸大文件

可以通過BufferedReader 流的形式進行流緩存,之後通過readLine方法獲取到緩存的內容。
可以通過「FileOutputStream」創建文件實例,之後過「OutputStreamWriter」流的形式進行存儲。舉例:
BufferedReader bre = null;
OutputStreamWriter pw = null;//定義一個流
try {
pw = new OutputStreamWriter(new FileOutputStream(「D:/test.txt」),"GBK");//確認流的輸出文件和編碼格式,此過程創建了「test.txt」實例

String file = "D:/test/test.txt";
bre = new BufferedReader(new FileReader(file));//此時獲取到的bre就是整個文件的緩存流
while ((str = bre.readLine())!= null) // 判斷最後一行不存在,為空結束循環
{
pw.write(str);
};
bre.close();//關閉流
pw.close();//關閉流
備註:文件流用完之後必須及時通過close方法關閉,否則會一直處於打開狀態,直至程序停止,增加系統負擔。

❾ Java 文件傳輸

byte[]
buf
=
new
byte[1024];
//read是輸入流中的一個方法,判斷流中是否還有數據,c!=-1就意味著流中無數據,所以應跳出循環,跟溢出沒關系
while((c
=
fis.read(buf))!
=-1){
fos.write(buf,o,c);//讀一位元組寫一位元組
}

❿ java數據傳送

1、在瀏覽器設置欄打開調試模式或者直接快捷鍵F12,進入後在調試窗口選擇network也簽,觸發注冊按鈕,這時候可以看到點擊按鈕後程序真實的數據提交地址、參數結構等。
2、在自己的頁面通過js模擬還原A網站的實際請求地址。