全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1036
推到 Plurk!
推到 Facebook!

圖像檔分散拆件問題???

尚未結案
Zonda
一般會員


發表:23
回覆:40
積分:12
註冊:2003-10-30

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-01-06 16:40:54 IP:202.175.xxx.xxx 未訂閱
請教當我用Datagram socket去Send圖像檔時,每當遇到100-200KB的圖像檔時 住住耍要分散去幾個ByteArray存傳,每當我存入第一個ByteArray時就發生問題 如:ArrayIndexOutOfBoundsException 以下就是發生問題的地方: Global Variable: private byte[] ba = new byte[1000]; private byte[] ba2 = new byte[1000]; private byte[] ba3 = new byte[50000]; private byte[] ba4 = new byte[50000]; private byte[] ba5 = new byte[30000]; private byte[] Imgba = new byte[200000]; public synchronized int ReadToByte(FileInputStream fis, DataBufferByte dbb, String filepath) { int num2 = 0; int num3 = 0; int addnum2 = 0; try { fis = new FileInputStream(new File(filepath)); num2 = fis.read(Imgba, 0, Imgba.length); dbb = new DataBufferByte(Imgba, Imgba.length); ------> for (int i = 0;i <= ba3.length; i) { ba3 = dbb.getData(i); } for (int i = 1;i < ba4.length; i) { ba4 = dbb.getData(ba3.length i); } fis.close(); return(num2); } catch (FileNotFoundException fe) { printMess("File cannot be open for reading ERROR!!!"); fe.printStackTrace(); } catch (IOException ioe) { printMess("IOException, file cannot be read to byte ERROR!!!"); ioe.printStackTrace(); } return(-1); }
neoart
版主


發表:22
回覆:582
積分:425
註冊:2003-05-09

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-01-07 11:59:01 IP:61.64.xxx.xxx 未訂閱
你試過把: "for (int i = 0;i <= ba3.length;++i) " 改成:
for (int i = 0;i 
嗎?        發表人 - neoart 於 2004/01/07  13:50:30
        
Zonda
一般會員


發表:23
回覆:40
積分:12
註冊:2003-10-30

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-01-07 13:56:48 IP:202.175.xxx.xxx 未訂閱
請問 i 要去到甚麼條件才要停???
Zonda
一般會員


發表:23
回覆:40
積分:12
註冊:2003-10-30

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-01-11 01:27:07 IP:202.175.xxx.xxx 未訂閱
Thanks!!!
系統時間:2024-05-10 0:35:49
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!